You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by je...@apache.org on 2002/05/30 09:04:45 UTC

cvs commit: httpd-2.0/modules/proxy proxy_http.c

jerenkrantz    02/05/30 00:04:45

  Modified:    include  httpd.h
               modules/http http_protocol.c
               modules/proxy proxy_http.c
  Log:
  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.
  
  Revision  Changes    Path
  1.184     +3 -1      httpd-2.0/include/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/httpd.h,v
  retrieving revision 1.183
  retrieving revision 1.184
  diff -u -r1.183 -r1.184
  --- httpd.h	6 May 2002 07:43:40 -0000	1.183
  +++ httpd.h	30 May 2002 07:04:45 -0000	1.184
  @@ -729,7 +729,8 @@
       /** 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 @@
   #define PROXYREQ_NONE 0		/**< No proxy */
   #define PROXYREQ_PROXY 1	/**< Standard proxy */
   #define PROXYREQ_REVERSE 2	/**< Reverse proxy */
  +#define PROXYREQ_RESPONSE 3 /**< Origin response */
   
   /* @} */
   
  
  
  
  1.427     +4 -1      httpd-2.0/modules/http/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/http_protocol.c,v
  retrieving revision 1.426
  retrieving revision 1.427
  diff -u -r1.426 -r1.427
  --- http_protocol.c	29 May 2002 23:04:14 -0000	1.426
  +++ http_protocol.c	30 May 2002 07:04:45 -0000	1.427
  @@ -829,8 +829,11 @@
            * 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;
  
  
  
  1.150     +4 -0      httpd-2.0/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_http.c,v
  retrieving revision 1.149
  retrieving revision 1.150
  diff -u -r1.149 -r1.150
  --- proxy_http.c	17 May 2002 11:24:16 -0000	1.149
  +++ proxy_http.c	30 May 2002 07:04:45 -0000	1.150
  @@ -663,6 +663,10 @@
        */
   
       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);