On Dec 10, 2005, at 4:15 PM, [EMAIL PROTECTED] wrote:

Author: rpluem
Date: Sat Dec 10 16:15:27 2005
New Revision: 355823

URL: http://svn.apache.org/viewcvs?rev=355823&view=rev
Log:
* Move handling of backends that broke after the headers have been sent
  into the proxy handler of mod_proxy.

  This patch still sets r->connection->aborted to 1 which is currently
vetoed by Roy. Moving it from the scheme handler to the proxy handler should ease the reimplementation of this, as the scheme handlers only needs to return PROXY_BACKEND_BROKEN to signal the above situation to
  the proxy handler.

Oy, crikey, I don't want that -- the proxy handler doesn't have the
information needed to complete the response.  As I said before, the
right way to do it is to send the error downstream.  There is no
need to leave the filter in an error state.

As it turns out, we also have a request_rec->no_cache variable that
is supposed to be set in this case.  I am curious whether the following
patch will work (after reverting r355823).

....Roy


Index: modules/proxy/mod_proxy_http.c
===================================================================
--- modules/proxy/mod_proxy_http.c      (revision 355728)
+++ modules/proxy/mod_proxy_http.c      (working copy)
@@ -1481,12 +1481,16 @@
                     }
                     else if (rv != APR_SUCCESS) {
/* In this case, we are in real trouble because
-                         * our backend bailed on us, so abort our
-                         * connection to our user too.
+                         * our backend bailed on us.
                          */
                         ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c,
"proxy: error reading response");
-                        c->aborted = 1;
+                        r->no_cache = 1;
+                        e = apr_bucket_eos_create(c->bucket_alloc);
+                        e->data = &rv;
+                        APR_BRIGADE_INSERT_TAIL(bb, e);
+                        ap_pass_brigade(r->output_filters, bb);
+                        backend->close = 1;
                         break;
                     }
                     /* next time try a non-blocking read */
Index: modules/cache/mod_disk_cache.c
===================================================================
--- modules/cache/mod_disk_cache.c      (revision 355728)
+++ modules/cache/mod_disk_cache.c      (working copy)
@@ -1010,7 +1010,7 @@
      * sanity checks.
      */
     if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) {
-        if (r->connection->aborted) {
+        if (r->connection->aborted || r->no_cache) {
             ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server,
                          "disk_cache: Discarding body for URL %s "
                          "because connection has been aborted.",



Reply via email to