Commit 8dc39a0a authored by Justin Erenkrantz's avatar Justin Erenkrantz
Browse files

Add a PROXYREQ_RESPONSE value for request_rec->proxyreq because it is

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
parent aad30330
Loading
Loading
Loading
Loading
+3 −1
Changes for include/httpd.h: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -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 */

/* @} */

+4 −1
Changes for modules/http/http_protocol.c: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -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;
+4 −0
Changes for modules/proxy/proxy_http.c: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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);