comparison src/http/ngx_http_upstream.c @ 5579:7586e7b2dbe9

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 18 Feb 2014 17:30:40 +0400
parents 188481078faf
children 4dee5ad51e9e
comparison
equal deleted inserted replaced
5578:e280ece17020 5579:7586e7b2dbe9
2555 } 2555 }
2556 2556
2557 if (u->peer.connection->read->ready 2557 if (u->peer.connection->read->ready
2558 || u->buffer.pos != u->buffer.last) 2558 || u->buffer.pos != u->buffer.last)
2559 { 2559 {
2560 ngx_post_event(c->read, &ngx_posted_events);
2560 ngx_http_upstream_process_upgraded(r, 1, 1); 2561 ngx_http_upstream_process_upgraded(r, 1, 1);
2562 return;
2561 } 2563 }
2562 2564
2563 ngx_http_upstream_process_upgraded(r, 0, 1); 2565 ngx_http_upstream_process_upgraded(r, 0, 1);
2564 } 2566 }
2565 2567