httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@covalent.net
Subject Re: eek. poor chunking behavior.
Date Tue, 12 Sep 2000 00:34:24 GMT
On Mon, 11 Sep 2000, Tony Finch wrote:
> Greg Stein <gstein@lyra.org> wrote:

> There's a problem with EOS in this scheme; to make things optimal in
> the normal case there will be just one trip through the filter stack
> with a brigade consisting of two buckets (a FILE and EOS, or a PIPE
> and EOS...). If the handler is using ap_r* then it won't send an EOS
> (and there may be some buffered data lurking) so it'll have to be sent
> by ap_finalize_request.

I am attaching a patch to fix EOS.  This basically adds an int to the
request_rec.  This int checks to see if the EOS bucket has already been
sent.  The int is initiall set to zero.  Ap_pass_brigade checks the last
bucket everytime it is called.  If the last bucket is an EOS bucket, then
the flag is set.  If not, it isn't.  This assumes that EOS will not be any
buckets after the EOS.  Since it doesn't make any sense to add a bucket
after the EOS bucket, I am ok with that.  ap_finalize_request checks that
flag before it sends an EOS bucket down.  This patch is completely
untested, but it makes logical sense.  It should fix the bug with the cgi
modules, namely that two EOS buckets get sent for every CGI request.

Ryan

Index: src/include/httpd.h
===================================================================
RCS file: /home/cvs/apache-2.0/src/include/httpd.h,v
retrieving revision 1.83
diff -u -d -b -w -u -r1.83 httpd.h
--- src/include/httpd.h	2000/09/01 14:47:20	1.83
+++ src/include/httpd.h	2000/09/12 00:14:22
@@ -800,6 +800,7 @@
     /** A list of filters to be used for this request 
      *  @defvar ap_filter_t *filters */
     struct ap_filter_t *filters;
+    int eos_sent;
 
 /* Things placed at the end of the record to avoid breaking binary
  * compatibility.  It would be nice to remember to reorder the entire
Index: src/main/http_protocol.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v
retrieving revision 1.120
diff -u -d -b -w -u -r1.120 http_protocol.c
--- src/main/http_protocol.c	2000/09/09 06:48:09	1.120
+++ src/main/http_protocol.c	2000/09/12 00:15:22
@@ -1921,7 +1921,9 @@
 API_EXPORT(void) ap_finalize_request_protocol(request_rec *r)
 {
     /* tell the filter chain there is no more content coming */
+    if (!r->eos_sent) {
     end_output_stream(r);
+    }
 }
 
 /* Here we deal with getting the request message body from the client.
Index: src/main/util_filter.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/main/util_filter.c,v
retrieving revision 1.14
diff -u -d -b -w -u -r1.14 util_filter.c
--- src/main/util_filter.c	2000/09/09 06:48:09	1.14
+++ src/main/util_filter.c	2000/09/12 00:15:23
@@ -154,6 +154,9 @@
  */
 API_EXPORT(apr_status_t) ap_pass_brigade(ap_filter_t *next, ap_bucket_brigade *bb)
 {
+    if (AP_BRIGADE_LAST(bb)->type == AP_BUCKET_EOS) {
+        next->r->eos_sent = 1;
+    }
     if (next) {
         return next->filter_func(next, bb);
     }

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Mime
View raw message