]> granicus.if.org Git - apache/commitdiff
mod_proxy_http: Correctly forward unexpected interim (HTTP 1xx) responses.
authorNick Kew <niq@apache.org>
Sun, 7 Oct 2007 13:43:26 +0000 (13:43 +0000)
committerNick Kew <niq@apache.org>
Sun, 7 Oct 2007 13:43:26 +0000 (13:43 +0000)
PR 16518

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@582631 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
docs/manual/mod/mod_proxy_http.xml
modules/proxy/mod_proxy_http.c

diff --git a/CHANGES b/CHANGES
index 5aa1d332a6b9feb36a7f20ad801f49fdb0253c93..e2c92e678809da400c649db7730cb1699d29a2cc 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -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]
index 4cd42f2abf7f77f1ceca98fcb1fdf1958ecf0188..13046a324c5c0fea4940f9fa4945b357f2d85466 100644 (file)
         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>
 
index a4959a2ff36c49abbbf84b6afe6364a1b0d29ba8..f2a6827f5c2e20b1f6bedab4c221394d63473dec 100644 (file)
@@ -1494,9 +1494,33 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
 
         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