diff options
| author | Maxim Dounin <mdounin@mdounin.ru> | 2014-02-18 17:30:40 +0400 |
|---|---|---|
| committer | Maxim Dounin <mdounin@mdounin.ru> | 2014-02-18 17:30:40 +0400 |
| commit | 5ec277847e8ff5a0990c03b93794d2e5d581f8e3 (patch) | |
| tree | 47e79f6b6087d8dfa6b24e18def1e4c06ed9c722 /src | |
| parent | 1dc1b0785b89743d637fa18e6d78a4999e2cf54c (diff) | |
| download | nginx-5ec277847e8ff5a0990c03b93794d2e5d581f8e3.tar.gz nginx-5ec277847e8ff5a0990c03b93794d2e5d581f8e3.tar.bz2 | |
Upstream: ngx_post_event() instead of upgraded call (ticket #503).
If a request is finalized in the first call to the
ngx_http_upstream_process_upgraded() function, e.g., because upstream
server closed the connection for some reason, in the second call
the u->peer.connection pointer will be null, resulting in segmentation
fault.
Fix is to avoid second direct call, and post event instead. This ensures
that ngx_http_upstream_process_upgraded() won't be called again if
a request is finalized.
Diffstat (limited to 'src')
| -rw-r--r-- | src/http/ngx_http_upstream.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index 41590eae9..f4dfeb3b6 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -2557,7 +2557,9 @@ ngx_http_upstream_upgrade(ngx_http_request_t *r, ngx_http_upstream_t *u) if (u->peer.connection->read->ready || u->buffer.pos != u->buffer.last) { + ngx_post_event(c->read, &ngx_posted_events); ngx_http_upstream_process_upgraded(r, 1, 1); + return; } ngx_http_upstream_process_upgraded(r, 0, 1); |
