]> granicus.if.org Git - apache/commitdiff
As Greg noted, set_keepalive has to happen before we check r->chunked, but
authorRyan Bloom <rbb@apache.org>
Wed, 24 Jan 2001 23:47:42 +0000 (23:47 +0000)
committerRyan Bloom <rbb@apache.org>
Wed, 24 Jan 2001 23:47:42 +0000 (23:47 +0000)
it also has to happen after ap_basic_http_header.  Otherwise, we don't
set r->connection->keepalive correctly, and it can be -1 for requests that
don't support keepalive.  This moves ap_basic_http_header to above the
call to set_keepalive (after reversing the previous patch), which should
be perfectly safe, while still fixing the original bug.
Submitted by: Greg Stein

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

modules/http/http_protocol.c

index cd6684b1ec3f9f419c9e45121814da5463570d83..48f2d877e321eda95d68b4f5433243be105b3c73 100644 (file)
@@ -2479,6 +2479,20 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f, apr_b
        fixup_vary(r);
     }
 
+    /* Need to add a fudge factor so that the CRLF at the end of the headers
+     * and the basic http headers don't overflow this buffer.
+     */
+    len += strlen(ap_get_server_version()) + 100;
+    buff_start = buff = apr_pcalloc(r->pool, len);
+    ap_basic_http_header(r, buff);
+    buff += strlen(buff);
+
+    h.r = r;
+    h.buf = buff;
+
+
+    ap_set_keepalive(r);
+
     if (r->chunked) {
         apr_table_mergen(r->headers_out, "Transfer-Encoding", "chunked");
         apr_table_unset(r->headers_out, "Content-Length");
@@ -2551,17 +2565,6 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f, apr_b
                  (void *) &len, r->headers_out, NULL);
     }
     
-    /* Need to add a fudge factor so that the CRLF at the end of the headers
-     * and the basic http headers don't overflow this buffer.
-     */
-    len += strlen(ap_get_server_version()) + 100;
-    buff_start = buff = apr_pcalloc(r->pool, len);
-    ap_basic_http_header(r, buff);
-    buff += strlen(buff);
-
-    h.r = r;
-    h.buf = buff;
-
     if (r->status == HTTP_NOT_MODIFIED) {
         apr_table_do((int (*)(void *, const char *, const char *)) form_header_field,
                     (void *) &h, r->headers_out,
@@ -2584,8 +2587,6 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f, apr_b
 
     terminate_header(buff);
 
-    ap_set_keepalive(r);
-
     r->sent_bodyct = 1;         /* Whatever follows is real body stuff... */
 
     b2 = apr_brigade_create(r->pool);