]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
tests: sync mod_http2 tests with mod_h2 and 2.4.x version checks
authorStefan Eissing <icing@apache.org>
Fri, 30 Jun 2023 08:16:25 +0000 (08:16 +0000)
committerStefan Eissing <icing@apache.org>
Fri, 30 Jun 2023 08:16:25 +0000 (08:16 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1910701 13f79535-47bb-0310-9956-ffa450edef68

test/modules/http2/test_003_get.py
test/modules/http2/test_004_post.py
test/modules/http2/test_106_shutdown.py
test/modules/http2/test_401_early_hints.py
test/modules/http2/test_600_h2proxy.py
test/modules/http2/test_601_h2proxy_twisted.py

index cc7e5117955ff02ae7f6700da90fee48f810399a..57c3775bfd0fb8e6bfaefa501d304ea17f1a9524 100644 (file)
@@ -251,7 +251,8 @@ content-type: text/html
 
     # produce an error during response body
     def test_h2_003_71(self, env, repeat):
-        pytest.skip("needs fix in core protocol handling")
+        if env.httpd_is_at_least('2.5.0'):
+            pytest.skip("needs fix in core protocol handling")
         url = env.mkurl("https", "cgi", "/h2test/error?body_error=timeout")
         r = env.curl_get(url)
         assert r.exit_code != 0, f"{r}"
@@ -261,7 +262,8 @@ content-type: text/html
 
     # produce an error, fail to generate an error bucket
     def test_h2_003_72(self, env, repeat):
-        pytest.skip("needs fix in core protocol handling")
+        if env.httpd_is_at_least('2.5.0'):
+            pytest.skip("needs fix in core protocol handling")
         url = env.mkurl("https", "cgi", "/h2test/error?body_error=timeout&error_bucket=0")
         r = env.curl_get(url)
         assert r.exit_code != 0, f"{r}"
index 0095e69990e44b5221ceb4d12f39d830f5995d94..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,16 +190,6 @@ class TestPost:
 
     def test_h2_004_41(self, env):
         # reproduce PR66597, double chunked encoding on redirects
-        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
index 4d0efaae7c4a2ca2c09871e0966af583170f41d6..83e143cef5811dea85a95d062c04e046000119d7 100644 (file)
@@ -66,7 +66,7 @@ class TestShutdown:
             r = env.curl_get(url, options=['-v'])
             # requests should succeed, but rarely connections get closed
             # before the response is received
-            if r.exit_code == 55:
+            if r.exit_code in [16, 55]:
                 # curl send error
                 assert r.response is None
             else:
index a2c223cbd9d8fa39191ddb767849954ba5050e94..57043052c2c4fc600449254e8fd5226257fed4b9 100644 (file)
@@ -9,6 +9,8 @@ class TestEarlyHints:
 
     @pytest.fixture(autouse=True, scope='class')
     def _class_scope(self, env):
+        if not env.httpd_is_at_least('2.4.58'):
+            pytest.skip(f'needs httpd 2.4.58')
         H2Conf(env).start_vhost(domains=[f"hints.{env.http_tld}"],
                                 port=env.https_port, doc_root="htdocs/test1"
         ).add("""
@@ -67,6 +69,8 @@ class TestEarlyHints:
 
     # H2EarlyHints enabled, no PUSH, check that it works for H2EarlyHint
     def test_h2_401_34(self, env, repeat):
+        if not env.httpd_is_at_least('2.4.58'):
+            pytest.skip(f'needs httpd 2.4.58')
         url = env.mkurl("https", "hints", "/006-early-no-push.html")
         r = env.nghttp().get(url)
         assert r.response["status"] == 200
index d6f145273010bd72eb359f65699ea52406f4b7df..4f071cc4376dd21b0f756a28dbd1731bc7357963 100644 (file)
@@ -153,7 +153,8 @@ class TestH2Proxy:
 
     # produce an error during response body
     def test_h2_600_31(self, env, repeat):
-        pytest.skip("needs fix in core protocol handling")
+        if env.httpd_is_at_least('2.5.0'):
+            pytest.skip("needs fix in core protocol handling")
         conf = H2Conf(env)
         conf.add_vhost_cgi(h2proxy_self=True)
         conf.install()
@@ -163,11 +164,12 @@ class TestH2Proxy:
         # depending on when the error is detect in proxying, if may RST the
         # stream (exit_code != 0) or give a 503 response.
         if r.exit_code == 0:
-            assert r.response['status'] == 503
+            assert r.response['status'] == 502
 
     # produce an error, fail to generate an error bucket
     def test_h2_600_32(self, env, repeat):
-        pytest.skip("needs fix in core protocol handling")
+        if env.httpd_is_at_least('2.5.0'):
+            pytest.skip("needs fix in core protocol handling")
         conf = H2Conf(env)
         conf.add_vhost_cgi(h2proxy_self=True)
         conf.install()
index 0079aa69853ac9dd00cafc61e4bbd537e08e2ae7..45b46d649c52f11ae90798c8e5d641c8ad5cb07f 100644 (file)
@@ -45,6 +45,8 @@ class TestH2ProxyTwisted:
         "data-1k", "data-10k", "data-100k", "data-1m",
     ])
     def test_h2_601_03_echo_fail_early(self, env, name):
+        if not env.httpd_is_at_least('2.4.58'):
+            pytest.skip(f'needs httpd 2.4.58')
         fpath = os.path.join(env.gen_dir, name)
         url = env.mkurl("https", "cgi", "/h2proxy/h2test/echo?fail_after=512")
         r = env.curl_upload(url, fpath, options=[])
@@ -55,6 +57,8 @@ class TestH2ProxyTwisted:
         "data-1k", "data-10k", "data-100k", "data-1m",
     ])
     def test_h2_601_04_echo_fail_late(self, env, name):
+        if not env.httpd_is_at_least('2.4.58'):
+            pytest.skip(f'needs httpd 2.4.58')
         fpath = os.path.join(env.gen_dir, name)
         url = env.mkurl("https", "cgi", f"/h2proxy/h2test/echo?fail_after={os.path.getsize(fpath)}")
         r = env.curl_upload(url, fpath, options=[])
@@ -62,6 +66,8 @@ class TestH2ProxyTwisted:
         assert r.exit_code == 92 or r.response["status"] == 502
 
     def test_h2_601_05_echo_fail_many(self, env):
+        if not env.httpd_is_at_least('2.4.58'):
+            pytest.skip(f'needs httpd 2.4.58')
         if not env.curl_is_at_least('8.0.0'):
             pytest.skip(f'need at least curl v8.0.0 for this')
         count = 200