Skip to content

Commit

Permalink
Upstream: disabled upgrading in subrequests.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
arut committed Oct 11, 2017
1 parent f1be23b commit 80f2e8f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/http/ngx_http_upstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -3206,6 +3206,13 @@ ngx_http_upstream_upgrade(ngx_http_request_t *r, ngx_http_upstream_t *u)

/* TODO: prevent upgrade if not requested or not possible */

if (r != r->main) {
ngx_log_error(NGX_LOG_ERR, c->log, 0,
"connection upgrade in subrequest");
ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}

r->keepalive = 0;
c->log->action = "proxying upgraded connection";

Expand Down

0 comments on commit 80f2e8f

Please sign in to comment.