httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rpl...@apache.org
Subject svn commit: r355823 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.c mod_proxy.h mod_proxy_http.c
Date Sun, 11 Dec 2005 00:15:33 GMT
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.

  mod_proxy.h: Add define for PROXY_BACKEND_BROKEN
  mod_proxy.c: Handle PROXY_BACKEND_BROKEN in proxy handler
  mod_proxy_http.c: Sent back PROXY_BACKEND_BROKEN if backend broke
  after we sent the headers.

Modified:
    httpd/httpd/trunk/modules/proxy/mod_proxy.c
    httpd/httpd/trunk/modules/proxy/mod_proxy.h
    httpd/httpd/trunk/modules/proxy/mod_proxy_http.c

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/proxy/mod_proxy.c?rev=355823&r1=355822&r2=355823&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Sat Dec 10 16:15:27 2005
@@ -758,6 +758,20 @@
                 worker->s->status |= PROXY_WORKER_IN_ERROR;
             }
         }
+        else if (access_status == PROXY_BACKEND_BROKEN) {
+            /*
+             * If the backend broke after the headers had been sent do not
+             * try another worker, but leave. Do not mark the worker as
+             * unsuable as this problem may not reoccur on the next request.
+             *
+             * TODO: Currently we abort the connection and notify all parties
+             * on the upstream that something went wrong by setting c->aborted
+             * to 1. This idea is currently vetoed and should be replaced with
+             * other methods
+             */
+            r->connection->aborted = 1;
+            break;
+        }
         else {
             /* Unrecoverable error.
              * Return the origin status code to the client.

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.h
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/proxy/mod_proxy.h?rev=355823&r1=355822&r2=355823&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.h (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.h Sat Dec 10 16:15:27 2005
@@ -238,6 +238,12 @@
     proxy_conn_rec *conn;   /* Single connection for prefork mpm's */
 };
 
+/*
+ * Return code that scheme handlers should return if the backend connection
+ * broke after they have sent the headers
+ */
+#define PROXY_BACKEND_BROKEN -10
+
 /* woker status flags */
 #define PROXY_WORKER_INITIALIZED    0x0001
 #define PROXY_WORKER_IGNORE_ERRORS  0x0002

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/proxy/mod_proxy_http.c?rev=355823&r1=355822&r2=355823&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_http.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_http.c Sat Dec 10 16:15:27 2005
@@ -1199,6 +1199,7 @@
                            * are being read. */
     int pread_len = 0;
     apr_table_t *save_table;
+    int backend_broken = 0;
 
     bb = apr_brigade_create(p, c->bucket_alloc);
 
@@ -1486,7 +1487,7 @@
                          */
                         ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c,
                                       "proxy: error reading response");
-                        c->aborted = 1;
+                        backend_broken = 1;
                         break;
                     }
                     /* next time try a non-blocking read */
@@ -1552,9 +1553,9 @@
         }
     } while (interim_response);
 
-    /* If our connection with the client is to be aborted, return DONE. */
-    if (c->aborted) {
-        return DONE;
+    /* Signal back that the backend broke after we sent the headers. */
+    if (backend_broken) {
+        return PROXY_BACKEND_BROKEN;
     }
 
     if (conf->error_override) {



Mime
View raw message