mirror of
https://github.com/nginx/nginx.git
synced 2025-07-22 20:38:26 +08:00
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.
This commit is contained in:
parent
d08e51c2da
commit
d5da8fa776
@ -2456,7 +2456,9 @@ ngx_http_upstream_upgrade(ngx_http_request_t *r, ngx_http_upstream_t *u)
|
|||||||
if (u->peer.connection->read->ready
|
if (u->peer.connection->read->ready
|
||||||
|| u->buffer.pos != u->buffer.last)
|
|| u->buffer.pos != u->buffer.last)
|
||||||
{
|
{
|
||||||
|
ngx_post_event(c->read, &ngx_posted_events);
|
||||||
ngx_http_upstream_process_upgraded(r, 1, 1);
|
ngx_http_upstream_process_upgraded(r, 1, 1);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_http_upstream_process_upgraded(r, 0, 1);
|
ngx_http_upstream_process_upgraded(r, 0, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user