From: Stefan Eissing Date: Tue, 20 Jun 2023 10:47:27 +0000 (+0000) Subject: Merge of 1909932,1909982 from trunk X-Git-Tag: 2.4.58-rc1-candidate~112 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7dd0de2c6d8b8e32a053f1155a47ae248b4356a6;p=thirdparty%2Fapache%2Fhttpd.git Merge of 1909932,1909982 from trunk *) mod_http2: avoid double chunked-encoding on internal redirects. PR 66597 [Yann Ylavic, Stefan Eissing] git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1910501 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/changes-entries/pr66597.txt b/changes-entries/pr66597.txt new file mode 100644 index 00000000000..958af0fb7f3 --- /dev/null +++ b/changes-entries/pr66597.txt @@ -0,0 +1,2 @@ + *) mod_http2: avoid double chunked-encoding on internal redirects. + PR 66597 [Yann Ylavic, Stefan Eissing] diff --git a/modules/http2/h2_c2.c b/modules/http2/h2_c2.c index 44a08d075e1..4553d3a48de 100644 --- a/modules/http2/h2_c2.c +++ b/modules/http2/h2_c2.c @@ -793,7 +793,7 @@ static int h2_c2_hook_post_read_request(request_rec *r) { h2_conn_ctx_t *conn_ctx = h2_conn_ctx_get(r->connection); - if (conn_ctx && conn_ctx->stream_id) { + if (conn_ctx && conn_ctx->stream_id && ap_is_initial_req(r)) { ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, "h2_c2(%s-%d): adding request filters", diff --git a/test/modules/http2/htdocs/cgi/xxx/test.json b/test/modules/http2/htdocs/cgi/xxx/test.json new file mode 100644 index 00000000000..ceafd0a135f --- /dev/null +++ b/test/modules/http2/htdocs/cgi/xxx/test.json @@ -0,0 +1 @@ +{"name": "test.json"} \ No newline at end of file diff --git a/test/modules/http2/test_004_post.py b/test/modules/http2/test_004_post.py index cefdef58621..295f989b88e 100644 --- a/test/modules/http2/test_004_post.py +++ b/test/modules/http2/test_004_post.py @@ -18,8 +18,15 @@ class TestPost: @pytest.fixture(autouse=True, scope='class') def _class_scope(self, env): TestPost._local_dir = os.path.dirname(inspect.getfile(TestPost)) - conf = H2Conf(env) - conf.add_vhost_cgi(proxy_self=True, h2proxy_self=True).install() + conf = H2Conf(env, extras={ + f'cgi.{env.http_tld}': [ + f'', + ' RewriteEngine On', + ' RewriteRule .* /proxy/echo.py [QSA]', + '', + ] + }) + conf.add_vhost_cgi(proxy_self=True).install() assert env.apache_restart() == 0 def local_src(self, fname): @@ -183,18 +190,6 @@ class TestPost: def test_h2_004_41(self, env): # reproduce PR66597, double chunked encoding on redirects - if not env.httpd_is_at_least('2.5.0'): - pytest.skip(f'needs r1909932+r1909982 from trunk') - conf = H2Conf(env, extras={ - f'cgi.{env.http_tld}': [ - f'', - ' RewriteEngine On', - ' RewriteRule .* /proxy/echo.py [QSA]', - '', - ] - }) - conf.add_vhost_cgi(proxy_self=True).install() - assert env.apache_restart() == 0 url = env.mkurl("https", "cgi", "/xxx/test.json") r = env.curl_post_data(url, data="0123456789", options=[]) assert r.exit_code == 0