httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r480135 - /httpd/httpd/trunk/modules/http/http_filters.c
Date Tue, 28 Nov 2006 17:36:55 GMT
Author: jim
Date: Tue Nov 28 09:36:45 2006
New Revision: 480135

URL: http://svn.apache.org/viewvc?view=rev&rev=480135
Log:
Apply patch for PR 41056 (19954) to fix chunk
filter. Now flushes work better.

Modified:
    httpd/httpd/trunk/modules/http/http_filters.c

Modified: httpd/httpd/trunk/modules/http/http_filters.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http/http_filters.c?view=diff&rev=480135&r1=480134&r2=480135
==============================================================================
--- httpd/httpd/trunk/modules/http/http_filters.c (original)
+++ httpd/httpd/trunk/modules/http/http_filters.c Tue Nov 28 09:36:45 2006
@@ -64,7 +64,8 @@
     enum {
         BODY_NONE,
         BODY_LENGTH,
-        BODY_CHUNK
+        BODY_CHUNK,
+        BODY_CHUNK_PART
     } state;
     int eos_sent;
 } http_ctx_t;
@@ -211,7 +212,13 @@
             bb = apr_brigade_create(f->r->pool, f->c->bucket_alloc);
 
             rv = ap_get_brigade(f->next, bb, AP_MODE_GETLINE,
-                                APR_BLOCK_READ, 0);
+                                block, 0);
+
+            /* for timeout */
+            if (block == APR_NONBLOCK_READ &&
+                rv == APR_SUCCESS && APR_BRIGADE_EMPTY(bb)) {
+                return APR_EAGAIN;
+            }
 
             if (rv == APR_SUCCESS) {
                 /* We have to check the length of the brigade we got back.
@@ -273,7 +280,7 @@
             APR_BRIGADE_INSERT_TAIL(b, e);
             ctx->eos_sent = 1;
             return APR_SUCCESS;
-        case BODY_CHUNK:
+        case BODY_CHUNK: case BODY_CHUNK_PART:
             {
                 char line[30];
                 apr_bucket_brigade *bb;
@@ -283,14 +290,25 @@
                 bb = apr_brigade_create(f->r->pool, f->c->bucket_alloc);
 
                 /* We need to read the CRLF after the chunk.  */
-                rv = ap_get_brigade(f->next, bb, AP_MODE_GETLINE,
-                                    APR_BLOCK_READ, 0);
-                apr_brigade_cleanup(bb);
+                if (ctx->state == BODY_CHUNK) {
+                    rv = ap_get_brigade(f->next, bb, AP_MODE_GETLINE,
+                                        block, 0);
+                    apr_brigade_cleanup(bb);
+                } else {
+                    rv = APR_SUCCESS;
+                }
 
                 if (rv == APR_SUCCESS) {
                     /* Read the real chunk line. */
                     rv = ap_get_brigade(f->next, bb, AP_MODE_GETLINE,
-                                        APR_BLOCK_READ, 0);
+                                        block, 0);
+                    /* Test timeout */
+                    if (block == APR_NONBLOCK_READ &&
+                        rv == APR_SUCCESS && APR_BRIGADE_EMPTY(bb)) {
+                        ctx->state = BODY_CHUNK_PART;
+                        return APR_EAGAIN;
+                    }
+                    ctx->state = BODY_CHUNK;
                     if (rv == APR_SUCCESS) {
                         rv = apr_brigade_flatten(bb, line, &len);
                         if (rv == APR_SUCCESS) {



Mime
View raw message