[PATCH]upstream:subrequest in memory will causes read timeout

李飞勃 lifeibo382005 at gmail.com
Mon Jun 27 06:27:51 MSD 2011


Hi,

This bug may appear when I use subrequest with flag
NGX_HTTP_SUBREQUEST_IN_MEMORY to a upstream url. If the server returns
a empty body, we say the content_length set to 0, so in upstream,  the
u->length set to 0 and the u->buffer is empty too. Empty u->buffer
causes if (n) statement not be executed. Since we can not known the
end of current response, we enter
ngx_http_upstream_process_body_in_memory to recv more data. While the
server will not return more data, in this case, recv will timeout.

In my patch, before call ngx_http_upstream_process_body_in_memory, if
the u->length is zero, we finalize current request and do not read
more data.

Thanks.

Feibo Li

email : lifeibo382005 at gmail.com
sina weibo: www.weibo.com/lifeibo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ngx_http_upstream.c.patch
Type: application/octet-stream
Size: 553 bytes
Desc: not available
URL: <http://nginx.org/pipermail/nginx-devel/attachments/20110627/60356fac/attachment.obj>


More information about the nginx-devel mailing list