-----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-----
diff --git a/src/http/ngx_http.h b/src/http/ngx_http.h
--- a/src/http/ngx_http.h
+++ b/src/http/ngx_http.h
@@ -111,6 +111,7 @@
#define NGX_HTTP_LAST 1
#define NGX_HTTP_FLUSH 2
+#define NGX_HTTP_SYNC 3
ngx_int_t ngx_http_send_special(ngx_http_request_t *r, ngx_uint_t flags);
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -2912,6 +2912,10 @@
b->flush = 1;
}
+ if (flags & NGX_HTTP_SYNC) {
+ b->sync = 1;
+ }
+
out.buf = b;
out.next = NULL;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel