]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge of 1909932,1909982 from trunk
authorStefan Eissing <icing@apache.org>
Tue, 20 Jun 2023 10:47:27 +0000 (10:47 +0000)
committerStefan Eissing <icing@apache.org>
Tue, 20 Jun 2023 10:47:27 +0000 (10:47 +0000)
  *) 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

changes-entries/pr66597.txt [new file with mode: 0644]
modules/http2/h2_c2.c
test/modules/http2/htdocs/cgi/xxx/test.json [new file with mode: 0644]
test/modules/http2/test_004_post.py

diff --git a/changes-entries/pr66597.txt b/changes-entries/pr66597.txt
new file mode 100644 (file)
index 0000000..958af0f
--- /dev/null
@@ -0,0 +1,2 @@
+  *) mod_http2: avoid double chunked-encoding on internal redirects.
+     PR 66597 [Yann Ylavic, Stefan Eissing]
index 44a08d075e19c3830b306d97830c3e27804e7e6c..4553d3a48de19c14bd1710990d72f9ff1cee9360 100644 (file)
@@ -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 (file)
index 0000000..ceafd0a
--- /dev/null
@@ -0,0 +1 @@
+{"name": "test.json"}
\ No newline at end of file
index cefdef586216026595b5b06d53d41522872666e7..295f989b88ec36a034251e5bb4c622740c3a3f85 100644 (file)
@@ -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'<Directory {env.server_docs_dir}/cgi/xxx>',
+                '  RewriteEngine On',
+                '  RewriteRule .* /proxy/echo.py [QSA]',
+                '</Directory>',
+            ]
+        })
+        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'<Directory {env.server_docs_dir}/cgi/xxx>',
-                '  RewriteEngine On',
-                '  RewriteRule .* /proxy/echo.py [QSA]',
-                '</Directory>',
-            ]
-        })
-        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