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, 30 May 2002 23:13:17 GMT
jerenkrantz    02/05/30 16:13:17

  Modified:    modules/http http_protocol.c
  Log:
  - Fix case where the initial chunk length was 0 was not handled correctly.
  - Fix bucket lifetimes so that they don't live longer than their brigades.
    That's not nice.
  - Simplify some usage of f->r->connection to f->c in the bucket creation
    calls.
  
  Revision  Changes    Path
  1.428     +24 -16    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.427
  retrieving revision 1.428
  diff -u -r1.427 -r1.428
  --- http_protocol.c	30 May 2002 07:04:45 -0000	1.427
  +++ http_protocol.c	30 May 2002 23:13:16 -0000	1.428
  @@ -813,10 +813,9 @@
                             " of %" APR_OFF_T_FMT, ctx->remaining, ctx->limit);
                   bb = apr_brigade_create(f->r->pool, f->c->bucket_alloc);
                   e = ap_bucket_error_create(HTTP_REQUEST_ENTITY_TOO_LARGE, NULL,
  -                                           f->r->connection->pool,
  -                                           f->r->connection->bucket_alloc);
  +                                           f->r->pool, f->c->bucket_alloc);
                   APR_BRIGADE_INSERT_TAIL(bb, e);
  -                e = apr_bucket_eos_create(f->r->connection->bucket_alloc);
  +                e = apr_bucket_eos_create(f->c->bucket_alloc);
                   APR_BRIGADE_INSERT_TAIL(bb, e);
                   return ap_pass_brigade(f->r->output_filters, bb);
               }
  @@ -834,7 +833,7 @@
            * proxied *response*, proxy responses MUST be exempt.
            */
           if (ctx->state == BODY_NONE && f->r->proxyreq != PROXYREQ_RESPONSE)
{
  -            e = apr_bucket_eos_create(f->r->connection->bucket_alloc);
  +            e = apr_bucket_eos_create(f->c->bucket_alloc);
               APR_BRIGADE_INSERT_TAIL(b, e);
               return APR_SUCCESS;
           }
  @@ -878,25 +877,33 @@
               ctx->remaining = get_chunk_size(line);
               /* Detect chunksize error (such as overflow) */
               if (ctx->remaining < 0) {
  -                apr_brigade_cleanup(bb);
  +                bb = apr_brigade_create(f->c->pool, f->c->bucket_alloc);
                   e = ap_bucket_error_create(HTTP_REQUEST_ENTITY_TOO_LARGE, NULL,
  -                                           f->r->connection->pool,
  -                                           f->r->connection->bucket_alloc);
  +                                           f->r->pool,
  +                                           f->c->bucket_alloc);
                   APR_BRIGADE_INSERT_TAIL(bb, e);
  -                e = apr_bucket_eos_create(f->r->connection->bucket_alloc);
  +                e = apr_bucket_eos_create(f->c->bucket_alloc);
                   APR_BRIGADE_INSERT_TAIL(bb, e);
                   return ap_pass_brigade(f->r->output_filters, bb);
               }
  +
  +            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(f->c->bucket_alloc);
  +                APR_BRIGADE_INSERT_TAIL(b, e);
  +                return APR_SUCCESS;
  +            }
           } 
       }
   
       if (!ctx->remaining) {
  -        conn_rec *c = f->r->connection;
           switch (ctx->state) {
           case BODY_NONE:
               break;
           case BODY_LENGTH:
  -            e = apr_bucket_eos_create(c->bucket_alloc);
  +            e = apr_bucket_eos_create(f->c->bucket_alloc);
               APR_BRIGADE_INSERT_TAIL(b, e);
               return APR_SUCCESS;
           case BODY_CHUNK:
  @@ -929,9 +936,10 @@
                   if (ctx->remaining < 0) {
                       apr_brigade_cleanup(bb);
                       e = ap_bucket_error_create(HTTP_REQUEST_ENTITY_TOO_LARGE,
  -                                               NULL, c->pool, c->bucket_alloc);
  +                                               NULL, f->r->pool,
  +                                               f->c->bucket_alloc);
                       APR_BRIGADE_INSERT_TAIL(bb, e);
  -                    e = apr_bucket_eos_create(c->bucket_alloc);
  +                    e = apr_bucket_eos_create(f->c->bucket_alloc);
                       APR_BRIGADE_INSERT_TAIL(bb, e);
                       return ap_pass_brigade(f->r->output_filters, bb);
                   }
  @@ -940,7 +948,7 @@
                       /* 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);
  +                    e = apr_bucket_eos_create(f->c->bucket_alloc);
                       APR_BRIGADE_INSERT_TAIL(b, e);
                       return APR_SUCCESS;
                   }
  @@ -988,10 +996,10 @@
                             " of %" APR_OFF_T_FMT, ctx->limit_used, ctx->limit);
               bb = apr_brigade_create(f->r->pool, f->c->bucket_alloc);
               e = ap_bucket_error_create(HTTP_REQUEST_ENTITY_TOO_LARGE, NULL,
  -                                       f->r->connection->pool,
  -                                       f->r->connection->bucket_alloc);
  +                                       f->r->pool,
  +                                       f->c->bucket_alloc);
               APR_BRIGADE_INSERT_TAIL(bb, e);
  -            e = apr_bucket_eos_create(f->r->connection->bucket_alloc);
  +            e = apr_bucket_eos_create(f->c->bucket_alloc);
               APR_BRIGADE_INSERT_TAIL(bb, e);
               return ap_pass_brigade(f->r->output_filters, bb);
           }
  
  
  

Mime
View raw message