]> granicus.if.org Git - apache/commitdiff
Add a PROXYREQ_RESPONSE value for request_rec->proxyreq because it is
authorJustin Erenkrantz <jerenkrantz@apache.org>
Thu, 30 May 2002 07:04:45 +0000 (07:04 +0000)
committerJustin Erenkrantz <jerenkrantz@apache.org>
Thu, 30 May 2002 07:04:45 +0000 (07:04 +0000)
possible that there can be different behavior at the protocol level if
request_rec isn't really a request but a response.

This stems from the fact that request bodies must be indicated by
Content-Length or Transfer-Encoding, but response bodies do not.  The
recent change to ap_http_filter to return EOS if there isn't a body broke
proxy.  Therefore, there must be some way for the proxy to indicate that
this is a response.  Accordingly, ap_http_filter can allow the BODY_NONE
iff this is a response.

Since r->proxyreq is set to PROXYREQ_PROXY even for the original request
from the client, that value isn't sufficient.  Hence, the introduction of
PROXYREQ_RESPONSE.

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

include/httpd.h
modules/http/http_protocol.c
modules/proxy/proxy_http.c

index bead0e204308f3df3f3fe164d57e210b9def0d53..78cdb4121aba788aec5c59650235809ddc616c33 100644 (file)
@@ -729,7 +729,8 @@ struct request_rec {
     /** HTTP/0.9, "simple" request (e.g. GET /foo\n w/no headers) */
     int assbackwards;
     /** A proxy request (calculated during post_read_request/translate_name)
-     *  possible values PROXYREQ_NONE, PROXYREQ_PROXY, PROXYREQ_REVERSE
+     *  possible values PROXYREQ_NONE, PROXYREQ_PROXY, PROXYREQ_REVERSE,
+     *                  PROXYREQ_RESPONSE
      */
     int proxyreq;
     /** HEAD request, as opposed to GET */
@@ -945,6 +946,7 @@ struct request_rec {
 #define PROXYREQ_NONE 0                /**< No proxy */
 #define PROXYREQ_PROXY 1       /**< Standard proxy */
 #define PROXYREQ_REVERSE 2     /**< Reverse proxy */
+#define PROXYREQ_RESPONSE 3 /**< Origin response */
 
 /* @} */
 
index 3939594eef87f5449beaec28689731b198bfd258..1fc2a666e9948fffd5638900b4694561639235e9 100644 (file)
@@ -829,8 +829,11 @@ apr_status_t ap_http_filter(ap_filter_t *f, apr_bucket_brigade *b,
          * RFC 2616 Section 4.4 note 5 states that connection-close
          * is invalid for a request entity - request bodies must be
          * denoted by C-L or T-E: chunked.
+         *
+         * Note that since the proxy uses this filter to handle the
+         * proxied *response*, proxy responses MUST be exempt.
          */
-        if (ctx->state == BODY_NONE) {
+        if (ctx->state == BODY_NONE && f->r->proxyreq != PROXYREQ_RESPONSE) {
             e = apr_bucket_eos_create(f->r->connection->bucket_alloc);
             APR_BRIGADE_INSERT_TAIL(b, e);
             return APR_SUCCESS;
index 8b08f7a6fa95ace68911ec6f1550b9fe28dc5e51..589d44d6bc42a59c2955a1ea220ee4027fcf2094 100644 (file)
@@ -663,6 +663,10 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
      */
 
     rp = ap_proxy_make_fake_req(origin, r);
+    /* In case anyone needs to know, this is a fake request that is really a
+     * response.
+     */
+    rp->proxyreq = PROXYREQ_RESPONSE;
 
     while (received_continue) {
         apr_brigade_cleanup(bb);