httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <...@ntrnet.net>
Subject [PATCH] allow multiple calls to ap_discard_request_body
Date Tue, 04 Jun 2002 13:55:36 GMT

This basically just implements what Greg described last night.  If HTTP_IN
has already sent an EOS bucket up the stack for this request, then it will
only ever respond with an EOS for this request.  This resolves calling
ap_discard_request_body multiple times for the same reques,t, which means
that there are some hacks that can be removed from that code, but I didn't
have the time to find them all.  Finally, this passes the entire test
suite, so it solves my original problem.  Can somebody who is having
problems with the proxy test this quickly?  For completeness, we should
probably include a call to ap_discard_request_body to ap_finalize_request,
but that isn't required for this solution to work.

Index: modules/http/http_protocol.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/http/http_protocol.c,v
retrieving revision 1.432
diff -u -d -b -w -u -r1.432 http_protocol.c
--- modules/http/http_protocol.c	31 May 2002 20:41:06 -0000	1.432
+++ modules/http/http_protocol.c	4 Jun 2002 13:49:29 -0000
@@ -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->remaining) {
-        switch (ctx->state) {
-        case BODY_NONE:
-            if (f->r->proxyreq != PROXYREQ_RESPONSE) {
+    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:
             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);
         }
     }

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
550 Jean St
Oakland CA 94610
-------------------------------------------------------------------------------


Mime
View raw message