[PATCH] NGX_HTTP_SYNC flag in ngx_http_send_special
Manlio Perillo
manlio.perillo at gmail.com
Fri May 4 17:52:33 UTC 2012
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Patch is attached, against mercurial mirror changeset 47cb3497fbab.
Use case:
I'm updating my ngx_http_wsgi_module.
In one of my test application, I return a chunk-encoded response.
The problem is that after last buffer is sent, I raise an exception,
causing Nginx to abort the request handling.
This, in turn, cause an incorrect chunk encoding (Python httplib fails
to read the response).
Calling
ngx_http_send_special(r, NGX_HTTP_FLUSH)
after last buffer does not help, however I found that using my patch,
calling
ngx_http_send_special(r, NGX_HTTP_FLUSH | NGX_HTTP_SYNC)
do help; now the response is correctly chunk encoded.
Please note that I tested my patch using 0.7.59, since
ngx_http_wsgi_module has some issues on recent Nginx versions (that I'm
going to fix).
Also note that I can not use NGX_HTTP_LAST (due to how
ngx_http_wsgi_module is implemented), and I'm not sure if is it correct
to set sync = 1 for a buffer that is not the last one.
Thanks Manlio Perillo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk+kF2EACgkQscQJ24LbaURqRQCcDFzOqeHtj4C6Wzc4S4o6I0EP
LSUAoI+fSlZ0MKXEnp0JdhiB6AAhgxbm
=fqo2
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ngx_http_sync_flag.diff
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20120504/7282a126/attachment.ksh>
More information about the nginx-devel
mailing list