You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2016/12/14 16:19:05 UTC

svn commit: r1774286 - /httpd/httpd/trunk/modules/http/http_filters.c

Author: ylavic
Date: Wed Dec 14 16:19:05 2016
New Revision: 1774286

URL: http://svn.apache.org/viewvc?rev=1774286&view=rev
Log:
Follow up to r1773761: restore EOC semantic.


Modified:
    httpd/httpd/trunk/modules/http/http_filters.c

Modified: httpd/httpd/trunk/modules/http/http_filters.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http/http_filters.c?rev=1774286&r1=1774285&r2=1774286&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http/http_filters.c (original)
+++ httpd/httpd/trunk/modules/http/http_filters.c Wed Dec 14 16:19:05 2016
@@ -689,13 +689,10 @@ static APR_INLINE int check_headers(requ
 
 static int check_headers_recursion(request_rec *r)
 {
-    request_rec *rr;
-    for (rr = r; rr; rr = rr->prev) {
-        void *dying = NULL;
-        apr_pool_userdata_get(&dying, "check_headers_recursion", rr->pool);
-        if (dying) {
-            return 1;
-        }
+    void *check = NULL;
+    apr_pool_userdata_get(&check, "check_headers_recursion", r->pool);
+    if (check) {
+        return 1;
     }
     apr_pool_userdata_setn("true", "check_headers_recursion", NULL, r->pool);
     return 0;
@@ -1206,7 +1203,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_
     header_filter_ctx *ctx = f->ctx;
     const char *ctype;
     ap_bucket_error *eb = NULL;
-    int eos = 0;
+    apr_bucket *eos = NULL;
 
     AP_DEBUG_ASSERT(!r->main);
 
@@ -1227,13 +1224,6 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_
          e != APR_BRIGADE_SENTINEL(b);
          e = APR_BUCKET_NEXT(e))
     {
-        if (ctx->headers_error) {
-            if (APR_BUCKET_IS_EOS(e)) {
-                eos = 1;
-                break;
-            }
-            continue;
-        }
         if (AP_BUCKET_IS_ERROR(e) && !eb) {
             eb = e->data;
             continue;
@@ -1246,6 +1236,9 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_
             ap_remove_output_filter(f);
             return ap_pass_brigade(f->next, b);
         }
+        if (ctx->headers_error && APR_BUCKET_IS_EOS(e)) {
+            eos = e;
+        }
     }
     if (ctx->headers_error) {
         if (!eos) {
@@ -1271,10 +1264,9 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_
             ap_die(HTTP_INTERNAL_SERVER_ERROR, r);
             return AP_FILTER_ERROR;
         }
-        AP_DEBUG_ASSERT(APR_BUCKET_IS_EOS(e));
-        APR_BUCKET_REMOVE(e);
+        APR_BUCKET_REMOVE(eos);
         apr_brigade_cleanup(b);
-        APR_BRIGADE_INSERT_TAIL(b, e);
+        APR_BRIGADE_INSERT_TAIL(b, eos);
         r->status = HTTP_INTERNAL_SERVER_ERROR;
         r->content_type = r->content_encoding = NULL;
         r->content_languages = NULL;