From ae6f4e04aedbc83ed124a4c8cad682e9081d0bf5 Mon Sep 17 00:00:00 2001 From: Stefan Eissing Date: Wed, 22 Jul 2015 14:44:06 +0000 Subject: [PATCH] renamed H2InitialWindowSize to H2WindowSize, fixed post_read registration to be really first to install necessary response parsing filters git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1692285 13f79535-47bb-0310-9956-ffa450edef68 --- modules/http2/h2_config.c | 4 ++-- modules/http2/h2_from_h1.c | 6 ------ modules/http2/h2_from_h1.h | 2 -- modules/http2/h2_h2.c | 8 ++++++++ modules/http2/h2_task_output.c | 4 ---- modules/http2/h2_task_output.h | 2 -- 6 files changed, 10 insertions(+), 16 deletions(-) diff --git a/modules/http2/h2_config.c b/modules/http2/h2_config.c index 08e19ea404..b038b5982f 100644 --- a/modules/http2/h2_config.c +++ b/modules/http2/h2_config.c @@ -429,8 +429,8 @@ const command_rec h2_cmds[] = { RSRC_CONF, "on to enable HTTP/2 protocol handling"), AP_INIT_TAKE1("H2MaxSessionStreams", h2_conf_set_max_streams, NULL, RSRC_CONF, "maximum number of open streams per session"), - AP_INIT_TAKE1("H2InitialWindowSize", h2_conf_set_window_size, NULL, - RSRC_CONF, "initial window size on client DATA"), + AP_INIT_TAKE1("H2WindowSize", h2_conf_set_window_size, NULL, + RSRC_CONF, "window size on client DATA"), AP_INIT_TAKE1("H2MaxHeaderListSize", h2_conf_set_max_hl_size, NULL, RSRC_CONF, "maximum acceptable size of request headers"), AP_INIT_TAKE1("H2MinWorkers", h2_conf_set_min_workers, NULL, diff --git a/modules/http2/h2_from_h1.c b/modules/http2/h2_from_h1.c index 0d39248ad8..5e5a92753b 100644 --- a/modules/http2/h2_from_h1.c +++ b/modules/http2/h2_from_h1.c @@ -648,9 +648,3 @@ apr_status_t h2_response_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) } return ap_pass_brigade(f->next, bb); } - -void h2_from_h1_die(h2_from_h1 *from_h1, int status, request_rec *r) -{ - r->status = status; - from_h1->response = create_response(from_h1, r); -} diff --git a/modules/http2/h2_from_h1.h b/modules/http2/h2_from_h1.h index a8446fbc76..115a314266 100644 --- a/modules/http2/h2_from_h1.h +++ b/modules/http2/h2_from_h1.h @@ -75,8 +75,6 @@ apr_status_t h2_from_h1_read_response(h2_from_h1 *from_h1, struct h2_response *h2_from_h1_get_response(h2_from_h1 *from_h1); -void h2_from_h1_die(h2_from_h1 *from_h1, int status, request_rec *r); - h2_from_h1_state_t h2_from_h1_get_state(h2_from_h1 *from_h1); apr_status_t h2_response_output_filter(ap_filter_t *f, apr_bucket_brigade *bb); diff --git a/modules/http2/h2_h2.c b/modules/http2/h2_h2.c index 5c36f3fb10..7414c53bba 100644 --- a/modules/http2/h2_h2.c +++ b/modules/http2/h2_h2.c @@ -117,6 +117,12 @@ void h2_h2_register_hooks(void) mod_reqtimeout, NULL, APR_HOOK_LAST); ap_hook_post_read_request(h2_h2_post_read_req, NULL, NULL, APR_HOOK_MIDDLE); + /* With "H2SerializeHeaders On", we install the filter in this hook + * that parses the response. This needs to happen before any other post + * read function terminates the request with an error. Otherwise we will + * never see the response. + */ + ap_hook_post_read_request(h2_h2_post_read_req, NULL, NULL, APR_HOOK_REALLY_FIRST); } int h2_h2_remove_timeout(conn_rec* c) @@ -214,12 +220,14 @@ static int h2_h2_post_read_req(request_rec *r) ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "adding h1_to_h2_resp output filter"); if (env->serialize_headers) { + ap_remove_output_filter_byhandle(r->output_filters, "H1_TO_H2_RESP"); ap_add_output_filter("H1_TO_H2_RESP", env, r, r->connection); } else { /* replace the core http filter that formats response headers * in HTTP/1 with our own that collects status and headers */ ap_remove_output_filter_byhandle(r->output_filters, "HTTP_HEADER"); + ap_remove_output_filter_byhandle(r->output_filters, "H2_RESPONSE"); ap_add_output_filter("H2_RESPONSE", env, r, r->connection); } } diff --git a/modules/http2/h2_task_output.c b/modules/http2/h2_task_output.c index 062d2d0dba..3b34490ff1 100644 --- a/modules/http2/h2_task_output.c +++ b/modules/http2/h2_task_output.c @@ -128,7 +128,3 @@ apr_status_t h2_task_output_write(h2_task_output *output, f, bb, output->env->io); } -void h2_task_output_die(h2_task_output *output, int status, request_rec *r) -{ - h2_from_h1_die(output->from_h1, status, r); -} diff --git a/modules/http2/h2_task_output.h b/modules/http2/h2_task_output.h index 3bb4575dff..86571a1e10 100644 --- a/modules/http2/h2_task_output.h +++ b/modules/http2/h2_task_output.h @@ -53,6 +53,4 @@ void h2_task_output_close(h2_task_output *output); int h2_task_output_has_started(h2_task_output *output); -void h2_task_output_die(h2_task_output *output, int status, request_rec *r); - #endif /* defined(__mod_h2__h2_task_output__) */ -- 2.50.1