]> granicus.if.org Git - apache/commitdiff
An impossible-to-hit edge case today; we described the request
authorWilliam A. Rowe Jr <wrowe@apache.org>
Mon, 8 Aug 2005 00:57:52 +0000 (00:57 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Mon, 8 Aug 2005 00:57:52 +0000 (00:57 +0000)
  as chunked - and if chunked always send the body termination "0"
  chunk header.

  Roy's requested change that we always send a body we could read
  in full as a C-L request ensures this code wasn't triggered; some
  change in the future could again reveal this edge case.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@230718 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy_http.c

index 939d908527781b7f0d9a43b29cf68ff65045701e..ac4e01c00e7fecd4a44c4bcd314f378538b0fc1b 100644 (file)
@@ -254,6 +254,7 @@ static apr_status_t stream_reqbody_chunked(apr_pool_t *p,
             bb = input_brigade;
         }
         
+        /* The request is flushed below this loop with chunk EOS header */
         status = pass_brigade(bucket_alloc, r, p_conn, origin, bb, 0);
         if (status != APR_SUCCESS) {
             return status;
@@ -285,14 +286,16 @@ static apr_status_t stream_reqbody_chunked(apr_pool_t *p,
             AP_DEBUG_ASSERT(APR_BUCKET_IS_EOS(e));
             apr_bucket_delete(e);
         }
-        e = apr_bucket_immortal_create(ASCII_ZERO ASCII_CRLF
-                                       /* <trailers> */
-                                       ASCII_CRLF,
-                                       5, bucket_alloc);
-        APR_BRIGADE_INSERT_TAIL(input_brigade, e);
         bb = input_brigade;
     }
-    
+
+    e = apr_bucket_immortal_create(ASCII_ZERO ASCII_CRLF
+                                   /* <trailers> */
+                                   ASCII_CRLF,
+                                   5, bucket_alloc);
+    APR_BRIGADE_INSERT_TAIL(bb, e);
+
+    /* Now we have headers-only, or the chunk EOS mark; flush it */
     status = pass_brigade(bucket_alloc, r, p_conn, origin, bb, 1);
     return status;
 }
@@ -365,7 +368,8 @@ static apr_status_t stream_reqbody_cl(apr_pool_t *p,
             bb = input_brigade;
         }
         
-        status = pass_brigade(bucket_alloc, r, p_conn, origin, bb, 0);
+        /* Once we hit EOS, we are ready to flush. */
+        status = pass_brigade(bucket_alloc, r, p_conn, origin, bb, seen_eos);
         if (status != APR_SUCCESS) {
             return status;
         }
@@ -392,16 +396,12 @@ static apr_status_t stream_reqbody_cl(apr_pool_t *p,
 
     if (header_brigade) {
         /* we never sent the header brigade since there was no request
-         * body; send it now
+         * body; send it now with the flush flag
          */
         terminate_headers(bucket_alloc, header_brigade);
         bb = header_brigade;
+        status = pass_brigade(bucket_alloc, r, p_conn, origin, bb, 1);
     }
-    else {
-        /* need to flush any pending data */
-        bb = input_brigade; /* empty now; pass_brigade() will add flush */
-    }
-    status = pass_brigade(bucket_alloc, r, p_conn, origin, bb, 1);
     return status;
 }
 
@@ -531,6 +531,7 @@ static apr_status_t spool_reqbody_cl(apr_pool_t *p,
         }
         APR_BRIGADE_INSERT_TAIL(header_brigade, e);
     }
+    /* This is all a single brigade, pass with flush flagged */
     status = pass_brigade(bucket_alloc, r, p_conn, origin, header_brigade, 1);
     return status;
 }