Browse Source

[core] connection_handle_read_state() tweak

no need to set transient state CON_STATE_REQUEST_END
master
Glenn Strauss 5 months ago
parent
commit
f98df3c62b
  1. 5
      src/connections.c
  2. 4
      src/h2.c

5
src/connections.c

@ -690,7 +690,6 @@ static int connection_handle_read_state(connection * const con) {
"oversized request-header -> sending Status 431");
r->http_status = 431; /* Request Header Fields Too Large */
r->keep_alive = 0;
connection_set_state(r, CON_STATE_REQUEST_END);
return 1;
}
@ -722,7 +721,6 @@ static int connection_handle_read_state(connection * const con) {
con->dst_addr_buf.ptr);
r->http_status = 400; /* Bad Request */
r->keep_alive = 0;
connection_set_state(r, CON_STATE_REQUEST_END);
return 1;
}
} while ((c = connection_read_header_more(con, cq, c, clen)));
@ -773,7 +771,6 @@ static int connection_handle_read_state(connection * const con) {
hdrs, header_len, "fd:%d rqst: ", con->fd);
http_request_headers_process(r, hdrs, hoff, con->proto_default_port);
chunkqueue_mark_written(cq, r->rqst_header_len);
connection_set_state(r, CON_STATE_REQUEST_END);
if (light_btst(r->rqst_htags, HTTP_HEADER_UPGRADE)
&& 0 == r->http_status
@ -1015,7 +1012,7 @@ connection_state_machine_loop (request_st * const r, connection * const con)
}
break;
}
/*if (r->state != CON_STATE_REQUEST_END) break;*/
/*connection_set_state(r, CON_STATE_REQUEST_END);*/
__attribute_fallthrough__
case CON_STATE_REQUEST_END: /* transient */
ostate = (0 == r->reqbody_length)

4
src/h2.c

@ -2682,8 +2682,6 @@ h2_retire_con (request_st * const h2r, connection * const con)
static void
h2_con_upgrade_h2c (request_st * const h2r, const buffer * const http2_settings)
{
/* status: (h2r->state == CON_STATE_REQUEST_END) for Upgrade: h2c */
/* HTTP/1.1 101 Switching Protocols
* Connection: Upgrade
* Upgrade: h2c
@ -2717,7 +2715,7 @@ h2_con_upgrade_h2c (request_st * const h2r, const buffer * const http2_settings)
request_st * const r = h2_init_stream(h2r, con);
/*(undo double-count; already incremented in CON_STATE_REQUEST_START)*/
--con->request_count;
r->state = h2r->state; /* CON_STATE_REQUEST_END */
r->state = CON_STATE_REQUEST_END;
r->http_status = 0;
r->http_method = h2r->http_method;
r->h2state = H2_STATE_HALF_CLOSED_REMOTE;

Loading…
Cancel
Save