1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-07 04:02:58 +03:00

mod_proxy(es): Avoid error response/document handling by the core if some

input filter already did it while reading client's payload.

When an input filter returns AP_FILTER_ERROR, it has already called ap_die()
or at least already responded to the client.

Here we don't want to lose AP_FILTER_ERROR when returning from proxy handlers,
so we use ap_map_http_request_error() to forward any AP_FILTER_ERROR to
ap_die() which knows whether a response needs to be completed or not.

Before this commit, returning an HTTP error code in this case caused a double
response to be generated.

Depends on r1657881 to preserve r->status (for logging) when nothing is to be
done by ap_die() when handling AP_FILTER_ERROR.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1657897 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yann Ylavic
2015-02-06 16:54:16 +00:00
parent be12754eed
commit b26841b8dc
7 changed files with 56 additions and 26 deletions

View File

@@ -337,7 +337,7 @@ static int stream_reqbody_chunked(apr_pool_t *p,
" from %s (%s)", p_conn->addr,
p_conn->hostname ? p_conn->hostname: "",
c->client_ip, c->remote_host ? c->remote_host: "");
return HTTP_BAD_REQUEST;
return ap_map_http_request_error(status, HTTP_BAD_REQUEST);
}
}
@@ -502,7 +502,7 @@ static int stream_reqbody_cl(apr_pool_t *p,
" from %s (%s)", p_conn->addr,
p_conn->hostname ? p_conn->hostname: "",
c->client_ip, c->remote_host ? c->remote_host: "");
return HTTP_BAD_REQUEST;
return ap_map_http_request_error(status, HTTP_BAD_REQUEST);
}
}
@@ -653,7 +653,7 @@ static int spool_reqbody_cl(apr_pool_t *p,
ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(02610)
"read request body failed from %s (%s)",
c->client_ip, c->remote_host ? c->remote_host: "");
return HTTP_BAD_REQUEST;
return ap_map_http_request_error(status, HTTP_BAD_REQUEST);
}
if (bytes_spooled || force_cl) {
@@ -837,7 +837,7 @@ static int ap_proxy_http_prefetch(apr_pool_t *p, request_rec *r,
" from %s (%s)",
p_conn->addr, p_conn->hostname ? p_conn->hostname: "",
c->client_ip, c->remote_host ? c->remote_host: "");
return HTTP_BAD_REQUEST;
return ap_map_http_request_error(status, HTTP_BAD_REQUEST);
}
apr_brigade_length(temp_brigade, 1, &bytes);