You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@apache.org on 2002/06/04 20:50:14 UTC

cvs commit: httpd-2.0/modules/http http_protocol.c

rbb         2002/06/04 11:50:14

  Modified:    .        CHANGES
               modules/http http_protocol.c
  Log:
  Allow ap_discard_request_body to be called multiple times in the
  same request.  Essentially, ap_http_filter keeps track of whether
  it has sent an EOS bucket up the stack, if so, it will only ever
  send an EOS bucket for this request.
  
  Submitted by:	Ryan Bloom, Justin Erenkrantz, Greg Stein
  
  Revision  Changes    Path
  1.808     +6 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.807
  retrieving revision 1.808
  diff -u -r1.807 -r1.808
  --- CHANGES	4 Jun 2002 07:12:25 -0000	1.807
  +++ CHANGES	4 Jun 2002 18:50:12 -0000	1.808
  @@ -1,5 +1,11 @@
   Changes with Apache 2.0.37
   
  +  *) Allow ap_discard_request_body to be called multiple times in the
  +     same request.  Essentially, ap_http_filter keeps track of whether
  +     it has sent an EOS bucket up the stack, if so, it will only ever
  +     send an EOS bucket for this request.  
  +     [Ryan Bloom, Justin Erenkrantz, Greg Stein]
  +
     *) Remove all special mod_ssl URIs.  This also fixes the bug where
        redirecting (.*) will allow an SSL protected page to be viewed
        without SSL.  [Ryan Bloom]
  
  
  
  1.433     +16 -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.432
  retrieving revision 1.433
  diff -u -r1.432 -r1.433
  --- http_protocol.c	31 May 2002 20:41:06 -0000	1.432
  +++ http_protocol.c	4 Jun 2002 18:50:13 -0000	1.433
  @@ -742,6 +742,7 @@
           BODY_LENGTH,
           BODY_CHUNK
       } state;
  +    int eos_sent;
   } http_ctx_t;
   
   /* This is the HTTP_INPUT filter for HTTP requests and responses from 
  @@ -769,6 +770,7 @@
           ctx->state = BODY_NONE;
           ctx->remaining = 0;
           ctx->limit_used = 0;
  +        ctx->eos_sent = 0;
   
           /* LimitRequestBody does not apply to proxied responses.
            * Consider implementing this check in its own filter. 
  @@ -817,6 +819,7 @@
                   APR_BRIGADE_INSERT_TAIL(bb, e);
                   e = apr_bucket_eos_create(f->c->bucket_alloc);
                   APR_BRIGADE_INSERT_TAIL(bb, e);
  +                ctx->eos_sent = 1;
                   return ap_pass_brigade(f->r->output_filters, bb);
               }
           }
  @@ -835,6 +838,7 @@
           if (ctx->state == BODY_NONE && f->r->proxyreq != PROXYREQ_RESPONSE) {
               e = apr_bucket_eos_create(f->c->bucket_alloc);
               APR_BRIGADE_INSERT_TAIL(b, e);
  +            ctx->eos_sent = 1;
               return APR_SUCCESS;
           }
   
  @@ -886,6 +890,7 @@
                   APR_BRIGADE_INSERT_TAIL(bb, e);
                   e = apr_bucket_eos_create(f->c->bucket_alloc);
                   APR_BRIGADE_INSERT_TAIL(bb, e);
  +                ctx->eos_sent = 1;
                   return ap_pass_brigade(f->r->output_filters, bb);
               }
   
  @@ -895,23 +900,26 @@
                   ap_get_mime_headers(f->r);
                   e = apr_bucket_eos_create(f->c->bucket_alloc);
                   APR_BRIGADE_INSERT_TAIL(b, e);
  +                ctx->eos_sent = 1;
                   return APR_SUCCESS;
               }
           } 
       }
   
  +    if (ctx->eos_sent) {
  +        e = apr_bucket_eos_create(f->c->bucket_alloc);
  +        APR_BRIGADE_INSERT_TAIL(b, e);
  +        return APR_SUCCESS;
  +    }
  +        
       if (!ctx->remaining) {
           switch (ctx->state) {
           case BODY_NONE:
  -            if (f->r->proxyreq != PROXYREQ_RESPONSE) {
  -                e = apr_bucket_eos_create(f->c->bucket_alloc);
  -                APR_BRIGADE_INSERT_TAIL(b, e);
  -                return APR_SUCCESS;
  -            }
               break;
           case BODY_LENGTH:
               e = apr_bucket_eos_create(f->c->bucket_alloc);
               APR_BRIGADE_INSERT_TAIL(b, e);
  +            ctx->eos_sent = 1;
               return APR_SUCCESS;
           case BODY_CHUNK:
               {
  @@ -950,6 +958,7 @@
                       APR_BRIGADE_INSERT_TAIL(bb, e);
                       e = apr_bucket_eos_create(f->c->bucket_alloc);
                       APR_BRIGADE_INSERT_TAIL(bb, e);
  +                    ctx->eos_sent = 1;
                       return ap_pass_brigade(f->r->output_filters, bb);
                   }
   
  @@ -959,6 +968,7 @@
                       ap_get_mime_headers(f->r);
                       e = apr_bucket_eos_create(f->c->bucket_alloc);
                       APR_BRIGADE_INSERT_TAIL(b, e);
  +                    ctx->eos_sent = 1;
                       return APR_SUCCESS;
                   }
               }
  @@ -1010,6 +1020,7 @@
               APR_BRIGADE_INSERT_TAIL(bb, e);
               e = apr_bucket_eos_create(f->c->bucket_alloc);
               APR_BRIGADE_INSERT_TAIL(bb, e);
  +            ctx->eos_sent = 1;
               return ap_pass_brigade(f->r->output_filters, bb);
           }
       }