nginx prepends extraneous "HTTP/1.1 100 Continue" headers to SSI responses

Igor Sysoev is at rambler-co.ru
Fri Dec 26 09:14:59 MSK 2008


On Fri, Dec 26, 2008 at 12:00:47AM +0100, piespy wrote:

> When using SSI to handle POST requests submitted with an "Expect:
> 100-continue" header (as Opera likes to send for >10KB post data),
> nginx will generate a response with "HTTP/1.1 100 Continue" for the
> request, *and* again for each SSI subrequest that has wait="yes",
> breaking the chunked transfer-encoding and causing the browser to
> terminate the connection prematurely.
> 
> I've been able to fix it, at least for my purposes, by setting
> sr->expect_tested in ngx_http_subrequest(). I can't tell if that's
> really a proper fix, or if a subrequest might actually need to send
> "HTTP/1.1 100 Continue" in some cases. (If that's so, then the real
> fix would probably require to associate the expect_tested variable
> with the response, not any request.)
> 
> It's probably an extremely rare use case and I'm happy with my fix,
> but I thought I'd report the problem here anyway.

Thank you. Here more correct patch, that does not test Expect header
in subrequests. There is another problem that "100 Continue" is issued
always even following response will be 403 or 405. I will fix this in
next release.


-- 
Igor Sysoev
http://sysoev.ru/en/
-------------- next part --------------
Index: src/http/ngx_http_core_module.c
===================================================================
--- src/http/ngx_http_core_module.c	(revision 1753)
+++ src/http/ngx_http_core_module.c	(working copy)
@@ -862,7 +862,10 @@
         return NGX_OK;
     }
 
-    if (r->headers_in.expect && r->http_version > NGX_HTTP_VERSION_10) {
+    if (r->headers_in.expect
+        && r == r->main
+        && r->http_version > NGX_HTTP_VERSION_10)
+    {
         expect = ngx_http_core_send_continue(r);
 
         if (expect != NGX_OK) {


More information about the nginx mailing list