httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@locus.apache.org
Subject cvs commit: apache-2.0/src/main http_protocol.c
Date Tue, 10 Oct 2000 17:04:21 GMT
trawick     00/10/10 10:04:20

  Modified:    src/main http_protocol.c
  Log:
  minor cleanups in http_filter() and ap_get_client_block()
  
  this is not the change to allow us to read broken-up header lines again :(
  
  . http_filter()
    - respect apr_status_t as set by bucket->read() or ap_get_brigade()
    - return apr_status_t instead of length
  . ap_get_client_block()
    - remove a confusing line which set the length parameter before
    - passing it to bucket->read()
  
  Revision  Changes    Path
  1.155     +17 -11    apache-2.0/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v
  retrieving revision 1.154
  retrieving revision 1.155
  diff -u -r1.154 -r1.155
  --- http_protocol.c	2000/10/09 19:03:24	1.154
  +++ http_protocol.c	2000/10/10 17:04:19	1.155
  @@ -858,9 +858,9 @@
   
   typedef struct http_filter_ctx {
       ap_bucket_brigade *b;
  -    int c_len;
   } http_ctx_t;
  -int http_filter(ap_filter_t *f, ap_bucket_brigade *b)
  +
  +apr_status_t http_filter(ap_filter_t *f, ap_bucket_brigade *b)
   {
   #define ASCII_CR '\015'
   #define ASCII_LF '\012'
  @@ -871,19 +871,23 @@
       int state = 0;
       http_ctx_t *ctx = f->ctx;
       ap_bucket_brigade *bb;
  -
  +    apr_status_t rv;
   
       if (!ctx) {
           f->ctx = ctx = apr_pcalloc(f->c->pool, sizeof(*ctx));
  -        ap_get_brigade(f->next, b);
  +        if ((rv = ap_get_brigade(f->next, b)) != APR_SUCCESS) {
  +            return rv;
  +        }
       }
       else {
           if (ctx->b) {
               AP_BRIGADE_CONCAT(b, ctx->b);
  -            ctx->b = NULL;
  +            ctx->b = NULL; /* XXX we just leaked a brigade structure */
           }
           else {
  -            ap_get_brigade(f->next, b);
  +            if ((rv = ap_get_brigade(f->next, b)) != APR_SUCCESS) {
  +                return rv;
  +            }
           }
       }
   
  @@ -902,17 +906,20 @@
               bb = ap_brigade_split(b, AP_BUCKET_NEXT(e));
               f->c->remaining = remain;
               ctx->b = bb;
  -            return length;
  +            return APR_SUCCESS;
           }
           else {
  +            f->c->remaining = remain;
               ctx->b = NULL;
  -            return length;
  +            return APR_SUCCESS;
           }
       }
   
       AP_BRIGADE_FOREACH(e, b) {
   
  -        e->read(e, (const char **)&buff, &length, 0);
  +        if ((rv = e->read(e, (const char **)&buff, &length, 0)) != APR_SUCCESS)
{
  +            return rv;
  +        }
   
           pos = buff + 1;
           while (pos < buff + length) {
  @@ -936,7 +943,7 @@
                   e->split(e, pos - buff);
                   bb = ap_brigade_split(b, AP_BUCKET_NEXT(e));
                   ctx->b = bb;
  -                return length;
  +                return APR_SUCCESS;
               }
           }
       }
  @@ -2464,7 +2471,6 @@
               }
           } while (AP_BRIGADE_EMPTY(r->connection->input_data));
   
  -        len_read = len_to_read;
           rv = b->read(b, &tempbuf, &len_read, 0);
           if (len_to_read < b->length) {
               b->split(b, len_to_read);
  
  
  

Mime
View raw message