You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ni...@apache.org on 2007/10/07 15:43:27 UTC

svn commit: r582631 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_proxy_http.xml modules/proxy/mod_proxy_http.c

Author: niq
Date: Sun Oct  7 06:43:26 2007
New Revision: 582631

URL: http://svn.apache.org/viewvc?rev=582631&view=rev
Log:
mod_proxy_http: Correctly forward unexpected interim (HTTP 1xx) responses.
PR 16518

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/docs/manual/mod/mod_proxy_http.xml
    httpd/httpd/trunk/modules/proxy/mod_proxy_http.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=582631&r1=582630&r2=582631&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sun Oct  7 06:43:26 2007
@@ -2,6 +2,11 @@
 Changes with Apache 2.3.0
 [ When backported to 2.2.x, remove entry from this file ]
 
+  *) mod_proxy_http: Correctly forward unexpected interim (HTTP 1xx)
+     responses from the backend according to RFC2616.  But make it
+     configurable in case something breaks on it.
+     PR 16518 [Nick Kew]
+
   *) mod_ext_filter: Prevent a hang on Windows when the filter
      input data is pipelined. 
      PR 29901 [Eric Covener]

Modified: httpd/httpd/trunk/docs/manual/mod/mod_proxy_http.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_proxy_http.xml?rev=582631&r1=582630&r2=582631&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_proxy_http.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_proxy_http.xml Sun Oct  7 06:43:26 2007
@@ -90,6 +90,17 @@
         request bodies to be sent to the backend using chunked transfer
         encoding.  This allows the request to be efficiently streamed,
         but requires that the backend server supports HTTP/1.1.</dd>
+        <dt>proxy-interim-response</dt>
+        <dd>This variable takes values <code>RFC</code> or
+        <code>Suppress</code>.  Earlier httpd versions would suppress
+        HTTP interim (1xx) responses sent from the backend.  This is
+        technically a violation of the HTTP protocol.  In practice,
+        if a backend sends an interim response, it may itself be
+        extending the protocol in a manner we know nothing about,
+        or just broken.  So this is now configurable: set
+        <code>proxy-interim-response RFC</code> to be fully protocol
+        compliant, or <code>proxy-interim-response Suppress</code>
+        to suppress interim responses.</dd>
     </dl>
 </section>
 

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_http.c?rev=582631&r1=582630&r2=582631&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_http.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_http.c Sun Oct  7 06:43:26 2007
@@ -1494,9 +1494,33 @@
 
         interim_response = ap_is_HTTP_INFO(r->status);
         if (interim_response) {
+	    /* RFC2616 tells us to forward this.
+	     *
+	     * OTOH, an interim response here may mean the backend
+	     * is playing sillybuggers.  The Client didn't ask for
+	     * it within the defined HTTP/1.1 mechanisms, and if
+	     * it's an extension, it may also be unsupported by us.
+	     *
+	     * There's also the possibility that changing existing
+	     * behaviour here might break something.
+	     *
+	     * So let's make it configurable.
+	     */
+            const char *policy = apr_table_get(r->subprocess_env,
+			                       "proxy-interim-response");
             ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL,
                          "proxy: HTTP: received interim %d response",
                          r->status);
+	    if (!policy || !strcasecmp(policy, "RFC")) {
+                ap_send_interim_response(r);
+	    }
+	    /* FIXME: refine this to be able to specify per-response-status
+	     * policies and maybe also add option to bail out with 502
+	     */
+	    else if (strcasecmp(policy, "Suppress")) {
+                ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL,
+                             "undefined proxy interim response policy");
+	    }
         }
         /* Moved the fixups of Date headers and those affected by
          * ProxyPassReverse/etc from here to ap_proxy_read_headers