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 2001/10/11 22:03:26 UTC

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

jerenkrantz    01/10/11 13:03:26

  Modified:    .        CHANGES
               modules/proxy proxy_http.c
  Log:
  Teach mod_proxy to live with the new filtering scheme.
  
  Tested with www.yahoo.com (Conn: Close), www.apache.org (CL), and
  www.apple.com (TE: Chunked).
  
  Revision  Changes    Path
  1.390     +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.389
  retrieving revision 1.390
  diff -u -r1.389 -r1.390
  --- CHANGES	2001/10/11 13:27:05	1.389
  +++ CHANGES	2001/10/11 20:03:26	1.390
  @@ -1,5 +1,8 @@
   Changes with Apache 2.0.26-dev
   
  +  *) Fix mod_proxy so that it handles chunked transfer-encoding and works
  +     with the new input filtering system.  [Justin Erenkrantz]
  +
     *) Introduce the MultiviewsMatch directive, to allow the operator
        to be flexible in recognizing Handlers and Filters filename
        extensions as part of the Multiviews matching logic, strict with
  
  
  
  1.102     +11 -7     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.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- proxy_http.c	2001/10/08 21:49:17	1.101
  +++ proxy_http.c	2001/10/11 20:03:26	1.102
  @@ -793,27 +793,26 @@
               (r->status != HTTP_NOT_MODIFIED)) {	/* not 304 */
   
               const char *buf;
  -            apr_off_t readbytes;
               if (ap_proxy_liststr((buf = apr_table_get(r->headers_out,
                                     "Transfer-Encoding")), "chunked")) {
               ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
                            "proxy: Transfer-Encoding Chunked!");
                   apr_table_unset(r->headers_out,"Content-Length");
               }
  -            /* if keepalive cancelled, read to EOF */
  -            if (p_conn->close) {
  -                readbytes = -1;
  -            }
   
               ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
                            "proxy: start body send");
  -    
  +             
               /*
                * if we are overriding the errors, we cant put the content of the
                * page into the brigade
                */
               if ( (conf->error_override ==0) || r->status < 400 ) {
               /* read the body, pass it to the output filters */
  +                apr_off_t readbytes;
  +                apr_bucket *e;
  +                rp->headers_in = r->headers_out;
  +                readbytes = 8192;
                   while (ap_get_brigade(rp->input_filters, 
                                          bb, 
                                         AP_MODE_NONBLOCKING, 
  @@ -823,17 +822,22 @@
                                    r->server, "proxy (PID %d): readbytes: %#x",
                                    getpid(), readbytes);
   #endif
  -
  +                    if (APR_BRIGADE_EMPTY(bb)) {
  +                        break;
  +                    }
                       if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) {
                           ap_pass_brigade(r->output_filters, bb);
                   		break;
                       }
  +                    e = apr_bucket_flush_create();
  +                    APR_BRIGADE_INSERT_TAIL(bb, e);
                       if (ap_pass_brigade(r->output_filters, bb) != APR_SUCCESS) {
                           /* Ack! Phbtt! Die! User aborted! */
                           p_conn->close = 1;  /* this causes socket close below */
                           break;
                       }
                       apr_brigade_cleanup(bb);
  +                    readbytes = 8192;
                   }
               }
               ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,