diff options
author | Yann Ylavic <ylavic@apache.org> | 2020-04-21 12:29:07 +0200 |
---|---|---|
committer | Yann Ylavic <ylavic@apache.org> | 2020-04-21 12:29:07 +0200 |
commit | ac762c1ae12b6620d6c7212f40b2d46e031d8d6c (patch) | |
tree | 6922ae4b6f5ccf8cd01ddb4b911280d33342bab6 /modules/http2/h2_request.c | |
parent | r1876779 follow-up. (diff) | |
download | apache2-ac762c1ae12b6620d6c7212f40b2d46e031d8d6c.tar.xz apache2-ac762c1ae12b6620d6c7212f40b2d46e031d8d6c.zip |
core: follow up to r1876664: allow ErrorDocument to read body when applicable
Unless ap_read_request() failed to read the request line or header, or
Transfer-Encoding is invalid, we can still provide the request body to custom
error handlers (ErrorDocument) that ask it (e.g. internal redirects to CGI).
So this commit splits early failure path (previously die_early label) in two,
die_unusable_input and die_before_hooks, where the latter preserves input
filters (including HTTP_IN).
Also, the code to apply the connection timeout and r->per_dir_config from the
server is now in a new apply_server_config() helper since it's used multiple
times. Note that apr_socket_timeout_set() is a noop if the new timeout is the
same as the one already in place, so there is no need to cache the old timeout
nor use apr_socket_timeout_get(). Likewise, r->server is initially set to
c->base_server so apply_server_config() is overall a noop when no change is
needed.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876784 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/http2/h2_request.c')
-rw-r--r-- | modules/http2/h2_request.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/modules/http2/h2_request.c b/modules/http2/h2_request.c index a3d3696704..9d96c300f3 100644 --- a/modules/http2/h2_request.c +++ b/modules/http2/h2_request.c @@ -289,6 +289,8 @@ request_rec *h2_request_create_rec(const h2_request *req, conn_rec *c) /* Validate HTTP/1 request and select vhost. */ if (!ap_parse_request_line(r) || !ap_check_request_header(r)) { + /* we may have switched to another server still */ + r->per_dir_config = r->server->lookup_defaults; access_status = r->status; r->status = HTTP_OK; goto die; @@ -328,12 +330,12 @@ die: * end the request with an EOR bucket for stream/pipeline accounting. */ { - apr_bucket_brigade *tmp_bb; - tmp_bb = ap_acquire_brigade(c); - APR_BRIGADE_INSERT_TAIL(tmp_bb, + apr_bucket_brigade *eor_bb; + eor_bb = ap_acquire_brigade(c); + APR_BRIGADE_INSERT_TAIL(eor_bb, ap_bucket_eor_create(c->bucket_alloc, r)); - ap_pass_brigade(c->output_filters, tmp_bb); - ap_release_brigade(c, tmp_bb); + ap_pass_brigade(c->output_filters, eor_bb); + ap_release_brigade(c, eor_bb); } r = NULL; |