--- server/core_filters.c (revision 1524321) +++ server/core_filters.c (working copy) @@ -152,6 +152,19 @@ apr_status_t ap_core_input_filter(ap_filter_t *f, if (APR_STATUS_IS_EAGAIN(rv) && block == APR_NONBLOCK_READ) { rv = APR_SUCCESS; } + /* When the socket is immediatly EOF, apr_brigade_split_line returns + * APR_SUCCESS with an empty brigade (socket_bucket_read morphes the + * socket into an empty buffer which in turn is stripped by + * apr_brigade_split_line). + * + * In blocking mode we should never return APR_SUCCESS with an empty + * brigade, we are APR_EOF now and for the next calls. + */ + else if (rv == APR_SUCCESS && block == APR_BLOCK_READ + && APR_BRIGADE_EMPTY(b)) { + AP_DEBUG_ASSERT(APR_BRIGADE_EMPTY(ctx->b)); + rv = APR_EOF; + } return rv; }