httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1538776 - in /httpd/httpd/trunk: CHANGES modules/http/chunk_filter.c modules/http/http_filters.c
Date Mon, 04 Nov 2013 21:31:28 GMT
Author: jim
Date: Mon Nov  4 21:31:27 2013
New Revision: 1538776

URL: http://svn.apache.org/r1538776
Log:
PR 55475: Detect incomplete body in HTTP input filter and return APR_INCOMPLETE

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

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1538776&r1=1538775&r2=1538776&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Mon Nov  4 21:31:27 2013
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) core: Detect incomplete body in HTTP input filter and return
+     APR_INCOMPLETE. PR 55475 [Yann Ylavic <ylavic dev gmail com>]
+
   *) mod_cgid: Use the servers Timeout for each read from a CGI script,
      allow override with new CGIDRequestTimeout directive. PR43494
      [Eric Covener, Toshikuni Fukaya <toshikuni-fukaya cybozu co jp>]

Modified: httpd/httpd/trunk/modules/http/chunk_filter.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http/chunk_filter.c?rev=1538776&r1=1538775&r2=1538776&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http/chunk_filter.c (original)
+++ httpd/httpd/trunk/modules/http/chunk_filter.c Mon Nov  4 21:31:27 2013
@@ -72,9 +72,9 @@ apr_status_t ap_http_chunk_filter(ap_fil
                 eos = e;
                 break;
             }
-            if (AP_BUCKET_IS_ERROR(e)
-                && (((ap_bucket_error *)(e->data))->status
-                    == HTTP_BAD_GATEWAY)) {
+            if (AP_BUCKET_IS_ERROR(e) &&
+                (((ap_bucket_error *)(e->data))->status == HTTP_BAD_GATEWAY ||
+                 ((ap_bucket_error *)(e->data))->status == HTTP_GATEWAY_TIME_OUT))
{
                 /*
                  * We had a broken backend. Memorize this in the filter
                  * context.

Modified: httpd/httpd/trunk/modules/http/http_filters.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http/http_filters.c?rev=1538776&r1=1538775&r2=1538776&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http/http_filters.c (original)
+++ httpd/httpd/trunk/modules/http/http_filters.c Mon Nov  4 21:31:27 2013
@@ -359,6 +359,10 @@ apr_status_t ap_http_filter(ap_filter_t 
                 return APR_EAGAIN;
             }
 
+            if (rv == APR_EOF) {
+                return APR_INCOMPLETE;
+            }
+
             if (rv != APR_SUCCESS) {
                 return rv;
             }
@@ -384,8 +388,8 @@ apr_status_t ap_http_filter(ap_filter_t 
 
                 apr_bucket_delete(e);
                 e = APR_BRIGADE_FIRST(b);
-                again = 1; /* come around again */
             }
+            again = 1; /* come around again */
 
             if (ctx->state == BODY_CHUNK_TRAILER) {
                 ap_get_mime_headers(f->r);
@@ -416,6 +420,11 @@ apr_status_t ap_http_filter(ap_filter_t 
                     return APR_EAGAIN;
                 }
 
+                if (rv == APR_EOF && ctx->state != BODY_NONE
+                        && ctx->remaining > 0) {
+                    return APR_INCOMPLETE;
+                }
+
                 if (rv != APR_SUCCESS) {
                     return rv;
                 }
@@ -432,7 +441,8 @@ apr_status_t ap_http_filter(ap_filter_t 
                     if (ctx->remaining > 0) {
                         e = APR_BRIGADE_LAST(b);
                         if (APR_BUCKET_IS_EOS(e)) {
-                            return APR_EOF;
+                            apr_bucket_delete(e);
+                            return APR_INCOMPLETE;
                         }
                     }
                     else if (ctx->state == BODY_CHUNK_DATA) {
@@ -1631,7 +1641,8 @@ apr_status_t ap_http_outerror_filter(ap_
              * Start of error handling state tree. Just one condition
              * right now :)
              */
-            if (((ap_bucket_error *)(e->data))->status == HTTP_BAD_GATEWAY) {
+            if (((ap_bucket_error *)(e->data))->status == HTTP_BAD_GATEWAY ||
+                ((ap_bucket_error *)(e->data))->status == HTTP_GATEWAY_TIME_OUT) {
                 /* stream aborted and we have not ended it yet */
                 r->connection->keepalive = AP_CONN_CLOSE;
             }



Mime
View raw message