--- modules/http/http_filters.c (revision 1522831) +++ modules/http/http_filters.c (working copy) @@ -440,6 +440,9 @@ apr_status_t ap_http_filter(ap_filter_t *f, apr_bu } /* If we get an error, then leave */ if (rv != APR_SUCCESS) { + if (rv == APR_EOF) { + return APR_INCOMPLETE; + } return rv; } /* @@ -525,6 +528,10 @@ apr_status_t ap_http_filter(ap_filter_t *f, apr_bu rv = ap_get_brigade(f->next, b, mode, block, readbytes); if (rv != APR_SUCCESS) { + if (rv == APR_EOF && ctx->remaining > 0 && + ctx->state != BODY_NONE) { + return APR_INCOMPLETE; + } return rv; } @@ -537,10 +544,9 @@ apr_status_t ap_http_filter(ap_filter_t *f, apr_bu if (ctx->state != BODY_NONE) { ctx->remaining -= totalread; - if (ctx->remaining > 0) { - e = APR_BRIGADE_LAST(b); - if (APR_BUCKET_IS_EOS(e)) - return APR_EOF; + if (ctx->remaining > 0 && !APR_BRIGADE_EMPTY(b) && + APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(b))) { + return APR_INCOMPLETE; } }