]> granicus.if.org Git - apache/commitdiff
Follow up to r1773761: don't check_headers() more than once.
authorYann Ylavic <ylavic@apache.org>
Mon, 12 Dec 2016 12:06:06 +0000 (12:06 +0000)
committerYann Ylavic <ylavic@apache.org>
Mon, 12 Dec 2016 12:06:06 +0000 (12:06 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1773779 13f79535-47bb-0310-9956-ffa450edef68

modules/http/http_filters.c

index c2548ec88b9fff35c9350775b8df24bc96a07117..1c00115fe7f02a309855ab4c7a2462782699cf92 100644 (file)
@@ -1199,15 +1199,17 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f,
     if (!ctx) {
         ctx = f->ctx = apr_pcalloc(r->pool, sizeof(header_filter_ctx));
     }
-    else if (ctx->headers_sent) {
-        /* r->header_only or HTTP_NO_CONTENT case below, don't let
-         * the body pass trhough.
-         */
-        apr_brigade_cleanup(b);
-        return APR_SUCCESS;
-    }
 
-    if (!ctx->headers_error && !check_headers(r)) {
+    if (ctx->headers_sent) {
+        if (r->header_only || r->status == HTTP_NO_CONTENT) {
+            /* r->header_only or HTTP_NO_CONTENT case below, don't let
+             * the body pass trhough.
+             */
+            apr_brigade_cleanup(b);
+            return APR_SUCCESS;
+        }
+    }
+    else if (!ctx->headers_error && !check_headers(r)) {
         /* Eat body until EOS */
         ctx->headers_error = 1;
     }
@@ -1382,10 +1384,10 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f,
     terminate_header(b2);
 
     ap_pass_brigade(f->next, b2);
+    ctx->headers_sent = 1;
 
     if (r->header_only || r->status == HTTP_NO_CONTENT) {
         apr_brigade_cleanup(b);
-        ctx->headers_sent = 1;
         return APR_SUCCESS;
     }