You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2005/08/08 02:57:55 UTC

svn commit: r230718 - /httpd/httpd/trunk/modules/proxy/mod_proxy_http.c

Author: wrowe
Date: Sun Aug  7 17:57:52 2005
New Revision: 230718

URL: http://svn.apache.org/viewcvs?rev=230718&view=rev
Log:

  An impossible-to-hit edge case today; we described the request
  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.

Modified:
    httpd/httpd/trunk/modules/proxy/mod_proxy_http.c

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/proxy/mod_proxy_http.c?rev=230718&r1=230717&r2=230718&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_http.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_http.c Sun Aug  7 17:57:52 2005
@@ -254,6 +254,7 @@
             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 @@
             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 @@
             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 @@
 
     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 @@
         }
         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;
 }