comparison src/http/ngx_http_upstream.c @ 7131:6a5a91de5b74

Upstream: disabled upgrading in subrequests. Upgrading an upstream connection is usually followed by reading from the client which a subrequest is not allowed to do. Moreover, accessing the header_in request field while processing upgraded connection ends up with a null pointer dereference since the header_in buffer is only created for the the main request.
author Roman Arutyunyan <arut@nginx.com>
date Wed, 11 Oct 2017 17:38:21 +0300
parents 882ad033d43c
children a762ddf22dbb
comparison
equal deleted inserted replaced
7130:882ad033d43c 7131:6a5a91de5b74
3204 c = r->connection; 3204 c = r->connection;
3205 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); 3205 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
3206 3206
3207 /* TODO: prevent upgrade if not requested or not possible */ 3207 /* TODO: prevent upgrade if not requested or not possible */
3208 3208
3209 if (r != r->main) {
3210 ngx_log_error(NGX_LOG_ERR, c->log, 0,
3211 "connection upgrade in subrequest");
3212 ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
3213 return;
3214 }
3215
3209 r->keepalive = 0; 3216 r->keepalive = 0;
3210 c->log->action = "proxying upgraded connection"; 3217 c->log->action = "proxying upgraded connection";
3211 3218
3212 u->read_event_handler = ngx_http_upstream_upgraded_read_upstream; 3219 u->read_event_handler = ngx_http_upstream_upgraded_read_upstream;
3213 u->write_event_handler = ngx_http_upstream_upgraded_write_upstream; 3220 u->write_event_handler = ngx_http_upstream_upgraded_write_upstream;