httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stodd...@apache.org
Subject cvs commit: httpd-2.0/modules/proxy proxy_util.c
Date Mon, 31 Dec 2001 20:43:59 GMT
stoddard    01/12/31 12:43:59

  Modified:    .        CHANGES
               modules/proxy proxy_util.c
  Log:
  Eliminate loop in ap_proxy_string_read(). Need to be able to handle
  getting an empty brigade from ap_get_brigade(). Also made sure that
  we always call ap_get_brigade() in readline mode.
  
  Submitted/Reviewed by: Adam Sussman & Bill Stoddard
  
  Revision  Changes    Path
  1.496     +2 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.495
  retrieving revision 1.496
  diff -u -r1.495 -r1.496
  --- CHANGES	31 Dec 2001 05:58:58 -0000	1.495
  +++ CHANGES	31 Dec 2001 20:43:58 -0000	1.496
  @@ -1,4 +1,6 @@
   Changes with Apache 2.0.30-dev
  +  *) Eliminate loop in ap_proxy_string_read().
  +     [Adam Sussman, Bill Stoddard]
   
     *) Provide $0..$9 results from mod_include regex parsing.
        [William Rowe]
  
  
  
  1.75      +18 -7     httpd-2.0/modules/proxy/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_util.c,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- proxy_util.c	29 Dec 2001 20:32:52 -0000	1.74
  +++ proxy_util.c	31 Dec 2001 20:43:59 -0000	1.75
  @@ -992,15 +992,16 @@
   }
   
   /* converts a series of buckets into a string 
  - * BillS says this function looks essentially identical to ap_rgetline() 
  - * in protocol.c. Deprecate this function and use apr_rgetline() instead?
  + * XXX: BillS says this function performs essentially the same function as 
  + * ap_rgetline() in protocol.c. Deprecate this function and use ap_rgetline() 
  + * instead? I think ap_proxy_string_read() will not work properly on non ASCII
  + * (EBCDIC) machines either.
    */
   PROXY_DECLARE(apr_status_t) ap_proxy_string_read(conn_rec *c, apr_bucket_brigade *bb,
                                                    char *buff, size_t bufflen, int *eos)
   {
       apr_bucket *e;
       apr_status_t rv;
  -    apr_off_t readbytes = 0;	/* line-at-a-time */
       char *pos = buff;
       char *response;
       int found = 0;
  @@ -1012,14 +1013,20 @@
   
       /* loop through each brigade */
       while (!found) {
  -
  +        apr_off_t zero = 0;
           /* get brigade from network one line at a time */
  -        if (APR_SUCCESS != (rv = ap_get_brigade(c->input_filters, bb, AP_MODE_BLOCKING,
&readbytes))) {
  +        if (APR_SUCCESS != (rv = ap_get_brigade(c->input_filters, bb, 
  +                                                AP_MODE_BLOCKING, 
  +                                                &zero /* readline */))) {
               return rv;
           }
  +        if (APR_BRIGADE_EMPTY(bb)) {
  +            /* The connection aborted or timed out */
  +            return APR_TIMEUP;
  +        }
   
           /* loop through each bucket */
  -        while (!found && !APR_BRIGADE_EMPTY(bb)) {
  +        while (!found) {
               e = APR_BRIGADE_FIRST(bb);
               if (APR_BUCKET_IS_EOS(e)) {
                   *eos = 1;
  @@ -1028,7 +1035,11 @@
                   if (APR_SUCCESS != apr_bucket_read(e, (const char **)&response, &len,
APR_BLOCK_READ)) {
                       return rv;
                   }
  -                /* is string LF terminated? */
  +                /* is string LF terminated? 
  +                 * XXX: This check can be made more efficient by simply checking 
  +                 * if the last character in the 'response' buffer is an ASCII_LF.
  +                 * See ap_rgetline() for an example.
  +                 */
                   if (memchr(response, APR_ASCII_LF, len)) {
                       found = 1;
                   }
  
  
  

Mime
View raw message