--- modules/http/http_filters.c (revision 1524321) +++ modules/http/http_filters.c (working copy) @@ -352,6 +352,10 @@ apr_status_t ap_http_filter(ap_filter_t *f, apr_bu return APR_EAGAIN; } + if (rv == APR_EOF) { + return APR_ECONNABORTED; + } + if (rv != APR_SUCCESS) { return rv; } @@ -377,8 +381,8 @@ apr_status_t ap_http_filter(ap_filter_t *f, apr_bu 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); @@ -409,6 +413,11 @@ apr_status_t ap_http_filter(ap_filter_t *f, apr_bu return APR_EAGAIN; } + if (rv == APR_EOF && ctx->state != BODY_NONE + && ctx->remaining > 0) { + return APR_ECONNABORTED; + } + if (rv != APR_SUCCESS) { return rv; } @@ -425,7 +434,8 @@ apr_status_t ap_http_filter(ap_filter_t *f, apr_bu if (ctx->remaining > 0) { e = APR_BRIGADE_LAST(b); if (APR_BUCKET_IS_EOS(e)) { - return APR_EOF; + apr_bucket_delete(e); + return APR_ECONNABORTED; } } else if (ctx->state == BODY_CHUNK_DATA) { @@ -473,6 +483,10 @@ apr_status_t ap_http_filter(ap_filter_t *f, apr_bu return APR_EAGAIN; } + if (rv == APR_EOF) { + return APR_ECONNABORTED; + } + if (rv != APR_SUCCESS) { return rv; } @@ -1610,9 +1624,12 @@ apr_status_t ap_http_outerror_filter(ap_filter_t * * Start of error handling state tree. Just one condition * right now :) */ - if (((ap_bucket_error *)(e->data))->status == HTTP_BAD_GATEWAY) { + switch (((ap_bucket_error *)(e->data))->status) { + case HTTP_BAD_GATEWAY: + case HTTP_GATEWAY_TIME_OUT: /* stream aborted and we have not ended it yet */ r->connection->keepalive = AP_CONN_CLOSE; + break; } continue; } --- modules/http/chunk_filter.c (revision 1524321) +++ modules/http/chunk_filter.c (working copy) @@ -72,15 +72,17 @@ apr_status_t ap_http_chunk_filter(ap_filter_t *f, eos = e; break; } - if (AP_BUCKET_IS_ERROR(e) - && (((ap_bucket_error *)(e->data))->status - == HTTP_BAD_GATEWAY)) { - /* - * We had a broken backend. Memorize this in the filter - * context. - */ - f->ctx = &bad_gateway_seen; - continue; + if (AP_BUCKET_IS_ERROR(e)) { + switch (((ap_bucket_error *)(e->data))->status) { + case HTTP_BAD_GATEWAY: + case HTTP_GATEWAY_TIME_OUT: + /* + * We had a broken backend. Memorize this in the filter + * context. + */ + f->ctx = &bad_gateway_seen; + continue; + } } if (APR_BUCKET_IS_FLUSH(e)) { flush = e;