httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Stoddard" <b...@wstoddard.com>
Subject [PATCH] Re: We have a bug in Apache 2.0 chunking...
Date Tue, 26 Jun 2001 14:03:21 GMT
This patch seems to fix the problem. Comments before I commit it?

Bill

Index: http_core.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/http/http_core.c,v
retrieving revision 1.279
diff -u -r1.279 http_core.c
--- http_core.c 2001/06/07 01:14:24 1.279
+++ http_core.c 2001/06/26 13:50:20
@@ -144,6 +144,7 @@
     for (more = NULL; b; b = more, more = NULL) {
  apr_off_t bytes = 0;
         apr_bucket *eos = NULL;
+        apr_bucket *flush = NULL;
         char chunk_hdr[20]; /* enough space for the snprintf below */
 
  APR_BRIGADE_FOREACH(e, b) {
@@ -152,6 +153,9 @@
   eos = e;
   break;
      }
+            if (APR_BUCKET_IS_FLUSH(e)) {
+                flush = e;
+            }
      else if (e->length == -1) {
                 /* unknown amount of data (e.g. a pipe) */
   const char *data;
@@ -206,12 +210,15 @@
             APR_BRIGADE_INSERT_HEAD(b, e);
 
             /*
-             * Insert the end-of-chunk CRLF before the EOS bucket, or
-             * appended to the brigade
+             * Insert the end-of-chunk CRLF before an EOS or
+             * FLUSH bucket, or appended to the brigade
              */
             e = apr_bucket_immortal_create(ASCII_CRLF, 2);
             if (eos != NULL) {
                 APR_BUCKET_INSERT_BEFORE(eos, e);
+            }
+            else if (flush != NULL) {
+                APR_BUCKET_INSERT_BEFORE(flush, e);
             }
             else {
                 APR_BRIGADE_INSERT_TAIL(b, e);


> > I've looked into this a bit more and it appears we have a chunking bug in Apache
2.0.
> > Specifically, Apache 2.0 is not terminating the first chunk with a CRLF as it should.
> >
> 



Mime
View raw message