httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject cvs commit: httpd-2.0/modules/http http_protocol.c
Date Thu, 18 Apr 2002 22:50:54 GMT
jerenkrantz    02/04/18 15:50:54

  Modified:    modules/http http_protocol.c
  Log:
  Switch ap_http_filter to use ap_get_brigade and apr_brigade_flatten
  instead of ap_getline - this prevents some odd looping issues that
  can cause problems.
  
  Also, when we call get_mime_headers to read the trailers, we need
  to reset our ctx->state to BODY_NONE - there should only be MIME-header
  information (followed by a blank CRLF line) - and we don't know
  how much data there will be - so it is by definition BODY_NONE.
  
  Revision  Changes    Path
  1.412     +23 -5     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.411
  retrieving revision 1.412
  diff -u -r1.411 -r1.412
  --- http_protocol.c	17 Apr 2002 04:09:07 -0000	1.411
  +++ http_protocol.c	18 Apr 2002 22:50:54 -0000	1.412
  @@ -831,10 +831,19 @@
           /* We can't read the chunk until after sending 100 if required. */
           if (ctx->state == BODY_CHUNK) {
               char line[30];
  +            apr_bucket_brigade *bb;
  +            apr_size_t len = 30;
   
  -            if ((rv = ap_getline(line, sizeof(line), f->r, 0)) < 0) {
  +            bb = apr_brigade_create(f->r->pool, f->c->bucket_alloc);
  +
  +            rv = ap_get_brigade(f->next, bb, AP_MODE_GETLINE,
  +                                APR_BLOCK_READ, 0);
  +
  +            if (rv != APR_SUCCESS) {
                   return rv;
               }
  +            apr_brigade_flatten(bb, line, &len);
  +
               ctx->remaining = get_chunk_size(line);
           } 
       }
  @@ -851,23 +860,32 @@
           case BODY_CHUNK:
               {
                   char line[30];
  +                apr_bucket_brigade *bb;
  +                apr_size_t len = 30;
   
  -                ctx->state = BODY_NONE;
  +                bb = apr_brigade_create(f->r->pool, f->c->bucket_alloc);
   
                   /* We need to read the CRLF after the chunk.  */
  -                if ((rv = ap_getline(line, sizeof(line), f->r, 0)) < 0) {
  +                rv = ap_get_brigade(f->next, bb, AP_MODE_GETLINE,
  +                                    APR_BLOCK_READ, 0);
  +                if (rv != APR_SUCCESS) {
                       return rv;
                   }
  +                apr_brigade_cleanup(bb);
   
                   /* Read the real chunk line. */
  -                if ((rv = ap_getline(line, sizeof(line), f->r, 0)) < 0) {
  +                rv = ap_get_brigade(f->next, bb, AP_MODE_GETLINE,
  +                                    APR_BLOCK_READ, 0);
  +
  +                if (rv != APR_SUCCESS) {
                       return rv;
                   }
  -                ctx->state = BODY_CHUNK;
  +                apr_brigade_flatten(bb, line, &len);
                   ctx->remaining = get_chunk_size(line);
   
                   if (!ctx->remaining) {
                       /* Handle trailers by calling ap_get_mime_headers again! */
  +                    ctx->state = BODY_NONE;
                       ap_get_mime_headers(f->r);
                       e = apr_bucket_eos_create(c->bucket_alloc);
                       APR_BRIGADE_INSERT_TAIL(b, e);
  
  
  

Mime
View raw message