httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roy T. Fielding" <field...@gbiv.com>
Subject Re: svn commit: r355823 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.c mod_proxy.h mod_proxy_http.c
Date Sun, 11 Dec 2005 01:49:10 GMT
On Dec 10, 2005, at 5:30 PM, Ruediger Pluem wrote:
> But with your approach you need to double the code in *each* scheme  
> handler.

mod_mem_cache doesn't look like it works right now.  I haven't looked
at the other schemes yet.

> r355823 tries to avoid this by doing it a little later in the proxy  
> handler.
> I currently comment only on the position *where* you do it and not  
> what.
> But of course in the proxy handler I do not have rv add hand any  
> longer.
> The remaining part of the patch could be done also in the proxy  
> handler
> with e->data set to an int that is non null.
> Ok. Other approach would be to put your code in a function of  
> proxy_util.c
> where every scheme handler can call it. That sounds also like a  
> good solution.

Ideally it would be in APR, but that runs into version problems.  Since
it is a general streams issue, I would put the function in httpd.h, but
right now I just want to know if it works at all (since I have no way
of testing it).

I think this is the full patch, but there may be a better place to
check for EOS errors.

....Roy

Index: server/core_filters.c
===================================================================
--- server/core_filters.c	(revision 355728)
+++ server/core_filters.c	(working copy)
@@ -678,6 +678,11 @@
              for (i = offset; i < nvec; ) {
                  apr_bucket *bucket = APR_BRIGADE_FIRST(bb);
                  if (APR_BUCKET_IS_METADATA(bucket)) {
+                    if (APR_BUCKET_IS_EOS(bucket) && bucket->data) {
+                        /* stream aborted and we have not ended it  
yet */
+                        c->keepalive = AP_CONN_CLOSE;
+                        bucket->data = NULL;
+                    }
                      APR_BUCKET_REMOVE(bucket);
                      apr_bucket_destroy(bucket);
                  }
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.",


Mime
View raw message