[bug] possible bug in output chains

Manlio Perillo manlio_perillo at libero.it
Tue Oct 9 14:59:16 MSD 2007


Manlio Perillo ha scritto:
> Manlio Perillo ha scritto:
>> Hi.
>>
>> When doing some tests with mod_wsgi I have found a possible problem 
>> with nginx output chains.
>>
>> I write two separate buffers, of size <~ 1024 bytes, and a final 
>> ngx_http_send_special(NGX_HTTP_LAST).
>>
>> The problem is that nginx sends to the client the content of the last 
>> buffer only, two times.
>>
>> If the buffer is large enough, or if gzip filter is enable, the output 
>> is correct.
>>
>> I don't know if this is a bug in mod_wsgi.
>>
> 
> Some more info: if I call finalize_request with an error, after having 
> sent the second buffer, then nginx sends incorrect trailing body to the 
> client.
> 
> I have tested this case with a buffer size of 16 bytes.
> 
> I have attached the output produced by nginx (and received by wget).
> 

And here is an strace:

writev(7, [{"HTTP/1.1 200 OK\r\nDate: Tue, 09 Oct 2007 10:51:08 
GMT\r\nContent-Type: text/plain\r\nTransfer-Encoding: 
chunked\r\nConnection: keep-alive\r\nServer: Test-read\r\nX-Powered-By: 
Python\r\nDate: \r\n\r\n", 183}, {"10\r\n", 4}, 
{"\0\0\0\0\34\265\f\10)\0\0\0\t\0\0\0", 16}, {"\r\n", 2}, {"10\r\n", 4}, 
{"\0\0\0\0\34\265\f\10)\0\0\0\t\0\0\0", 16}, {"\r\n", 2}, {"0\r\n\r\n", 
5}], 8) = 232

writev(7, [{"HTTP/1.1 500 Internal Server Error\r\nDate: Tue, 09 Oct 
2007 10:51:08 GMT\r\nContent-Type: text/html\r\nContent-Length: 
193\r\nTransfer-Encoding: chunked\r\nConnection: close\r\nServer: 
Test-read\r\nX-Powered-By: Python\r\nDate: \r\n\r\n", 217}, {"c1\r\n", 
4}, {"<html>\r\n<head><title>500 Internal Server 
Error</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>500 
Internal Server Error</h1></center>\r\n", 140}, 
{"<hr><center>nginx/0.5.31</center>\r\n</body>\r\n</html>\r\n", 53}, 
{"\r\n0\r\n\r\n", 7}], 5) = 421




nginx sends the headers two times...



Regards  Manlio Perillo





More information about the nginx mailing list