You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Sander Striker <st...@apache.org> on 2005/03/30 19:40:13 UTC

[PATCH] mod_proxy_http

Hi,

It seems like mod_proxy_http is being cute and not sending an EOS
bucket down the rest of the filter stack when it only receives
headers.  This (most likely) causes mod_cache's cache_save_filter
to not be run when it receives a 304.
Unfortunately I cannot 100% reproduce this locally, but the behaviour
seems to be consistent on a solaris production machine which I can't
fiddle about with too much (which includes testing this patch short
term).

In short: Some eyes please...

Thanks,

Sander

---
Index: modules/proxy/mod_proxy_http.c
===================================================================
--- modules/proxy/mod_proxy_http.c	(revision 157814)
+++ modules/proxy/mod_proxy_http.c	(working copy)
@@ -1331,9 +1331,21 @@
             }
             ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                          "proxy: end body send");
-        } else {
+        }
+        else {
             ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                          "proxy: header only");
+
+            /* Pass EOS bucket down the filter chain */
+            e = apr_bucket_eos_create(c->bucket_alloc);
+            APR_BRIGADE_INSERT_TAIL(bb, e);
+            if (ap_pass_brigade(r->output_filters, bb) != APR_SUCCESS
+                || c->aborted) {
+                /* Ack! Phbtt! Die! User aborted! */
+                backend->close = 1;  /* this causes socket close below */
+            }
+
+            apr_brigade_cleanup(bb);
         }
     } while (interim_response);

Re: [PATCH] mod_proxy_http

Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
--On Wednesday, March 30, 2005 7:40 PM +0200 Sander Striker 
<st...@apache.org> wrote:

> In short: Some eyes please...

+1.  Looks fine to me.  -- justin

Re: [PATCH] mod_proxy_http

Posted by Joe Orton <jo...@redhat.com>.
On Wed, Mar 30, 2005 at 07:40:13PM +0200, Sander Striker wrote:
> It seems like mod_proxy_http is being cute and not sending an EOS
> bucket down the rest of the filter stack when it only receives
> headers.  This (most likely) causes mod_cache's cache_save_filter
> to not be run when it receives a 304.
> Unfortunately I cannot 100% reproduce this locally, but the behaviour
> seems to be consistent on a solaris production machine which I can't
> fiddle about with too much (which includes testing this patch short
> term).

This broke the test of sending a 1xx response via the proxy; now the
final response gets eaten up somewhere.  I presume the right fix is to
just exclude interim responses from this logic, I committed that.

(t/modules/proxy.t in httpd-test)

GET /reverse/modules/cgi/nph-102.pl HTTP/1.1
Host: localhost

HTTP/1.1 102 Please Wait...
Date: Fri, 01 Apr 2005 09:25:55 GMT
Host: nph-102
Content-Length: 0
Content-Type: text/plain

this is nph-stdout