Skip to content

Commit

Permalink
supported http/2 (part5.3): removed logic of handling event after sen…
Browse files Browse the repository at this point in the history
…ding 200 OK

ngx_http_v2_send_output_queue() will do this for us.
  • Loading branch information
chobits committed Jul 25, 2023
1 parent bdae33b commit 0ae1f3f
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions ngx_http_proxy_connect_module.c
Expand Up @@ -665,7 +665,6 @@ ngx_http_v2_proxy_connect_send_connection_established(ngx_http_request_t *r)
// A proxy that supports CONNECT establishes a TCP connection [TCP] to the server identified in the :authority pseudo-header field. Once this connection is successfully established, the proxy sends a HEADERS frame containing a 2xx series status code to the client, as defined in [RFC7231], Section 4.3.6.
ngx_int_t rc;
ngx_connection_t *c;
ngx_http_core_loc_conf_t *clcf;
ngx_http_proxy_connect_ctx_t *ctx;
ngx_http_proxy_connect_upstream_t *u;

Expand All @@ -675,9 +674,6 @@ ngx_http_v2_proxy_connect_send_connection_established(ngx_http_request_t *r)

c = r->connection;

clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);


if (ctx->send_established) {
rc = ngx_http_output_filter(r, NULL);

Expand All @@ -698,12 +694,6 @@ ngx_http_v2_proxy_connect_send_connection_established(ngx_http_request_t *r)

ngx_add_timer(c->write, ctx->data_timeout);

if (ngx_handle_write_event(c->write, clcf->send_lowat) != NGX_OK) {
ngx_http_proxy_connect_finalize_request(r, u,
NGX_HTTP_INTERNAL_SERVER_ERROR);
return;
}

return;
}

Expand Down Expand Up @@ -731,18 +721,14 @@ ngx_http_v2_proxy_connect_send_connection_established(ngx_http_request_t *r)
r->write_event_handler = ngx_http_proxy_connect_write_downstream;
r->read_event_handler = ngx_http_proxy_connect_read_downstream;

if (ngx_handle_write_event(c->write, clcf->send_lowat) != NGX_OK) {
ngx_http_proxy_connect_finalize_request(r, u,
NGX_HTTP_INTERNAL_SERVER_ERROR);
return;
}

if (c->read->ready) {
r->read_event_handler(r);
return;
}
/*
* If there is an upstream read event, we dont need to handle
* it actively here.
*
* We can read the client body data (DATA frame) actively here.
*/

return;
r->read_event_handler(r);
}
#endif

Expand Down

0 comments on commit 0ae1f3f

Please sign in to comment.