From: Yann Ylavic Date: Mon, 12 Dec 2016 12:06:06 +0000 (+0000) Subject: Follow up to r1773761: don't check_headers() more than once. X-Git-Tag: 2.5.0-alpha~925 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=64350668a2c1a8d83f65cace8a5f0a41c1babae0;p=thirdparty%2Fapache%2Fhttpd.git Follow up to r1773761: don't check_headers() more than once. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1773779 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http/http_filters.c b/modules/http/http_filters.c index c2548ec88b9..1c00115fe7f 100644 --- a/modules/http/http_filters.c +++ b/modules/http/http_filters.c @@ -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; }