You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2021/10/13 12:26:21 UTC
svn commit: r1894190 - in /httpd/httpd/trunk:
modules/http2/h2_proxy_session.c test/modules/core/conftest.py
test/modules/http2/conftest.py
test/modules/http2/test_501_proxy_serverheader.py
Author: icing
Date: Wed Oct 13 12:26:21 2021
New Revision: 1894190
URL: http://svn.apache.org/viewvc?rev=1894190&view=rev
Log:
* mod_http2: resurrecting check for nghttp function
nghttp2_session_callbacks_set_on_invalid_header_callback
adding test for proxy server header behaviour
making test fixture package scoped for better performance
Added:
httpd/httpd/trunk/test/modules/http2/test_501_proxy_serverheader.py
Modified:
httpd/httpd/trunk/modules/http2/h2_proxy_session.c
httpd/httpd/trunk/test/modules/core/conftest.py
httpd/httpd/trunk/test/modules/http2/conftest.py
Modified: httpd/httpd/trunk/modules/http2/h2_proxy_session.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_proxy_session.c?rev=1894190&r1=1894189&r2=1894190&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_proxy_session.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_proxy_session.c Wed Oct 13 12:26:21 2021
@@ -692,6 +692,7 @@ static ssize_t stream_request_data(nghtt
}
}
+#ifdef H2_NG2_INVALID_HEADER_CB
static int on_invalid_header_cb(nghttp2_session *ngh2,
const nghttp2_frame *frame,
const uint8_t *name, size_t namelen,
@@ -710,6 +711,7 @@ static int on_invalid_header_cb(nghttp2_
frame->hd.stream_id,
NGHTTP2_PROTOCOL_ERROR);
}
+#endif
h2_proxy_session *h2_proxy_session_setup(const char *id, proxy_conn_rec *p_conn,
proxy_server_conf *conf,
@@ -751,8 +753,9 @@ h2_proxy_session *h2_proxy_session_setup
nghttp2_session_callbacks_set_on_header_callback(cbs, on_header);
nghttp2_session_callbacks_set_before_frame_send_callback(cbs, before_frame_send);
nghttp2_session_callbacks_set_send_callback(cbs, raw_send);
+#ifdef H2_NG2_INVALID_HEADER_CB
nghttp2_session_callbacks_set_on_invalid_header_callback(cbs, on_invalid_header_cb);
-
+#endif
nghttp2_option_new(&option);
nghttp2_option_set_peer_max_concurrent_streams(option, 100);
nghttp2_option_set_no_auto_window_update(option, 0);
Modified: httpd/httpd/trunk/test/modules/core/conftest.py
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/test/modules/core/conftest.py?rev=1894190&r1=1894189&r2=1894190&view=diff
==============================================================================
--- httpd/httpd/trunk/test/modules/core/conftest.py (original)
+++ httpd/httpd/trunk/test/modules/core/conftest.py Wed Oct 13 12:26:21 2021
@@ -14,7 +14,7 @@ def pytest_report_header(config, startdi
return f"core [apache: {env.get_httpd_version()}, mpm: {env.mpm_type}, {env.prefix}]"
-@pytest.fixture(scope="module")
+@pytest.fixture(scope="package")
def env(pytestconfig) -> CoreTestEnv:
level = logging.INFO
console = logging.StreamHandler()
@@ -28,7 +28,7 @@ def env(pytestconfig) -> CoreTestEnv:
return env
-@pytest.fixture(autouse=True, scope="module")
+@pytest.fixture(autouse=True, scope="package")
def _session_scope(env):
yield
assert env.apache_stop() == 0
Modified: httpd/httpd/trunk/test/modules/http2/conftest.py
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/test/modules/http2/conftest.py?rev=1894190&r1=1894189&r2=1894190&view=diff
==============================================================================
--- httpd/httpd/trunk/test/modules/http2/conftest.py (original)
+++ httpd/httpd/trunk/test/modules/http2/conftest.py Wed Oct 13 12:26:21 2021
@@ -27,7 +27,7 @@ def pytest_generate_tests(metafunc):
metafunc.parametrize('repeat', range(count))
-@pytest.fixture(scope="module")
+@pytest.fixture(scope="package")
def env(pytestconfig) -> H2TestEnv:
level = logging.INFO
console = logging.StreamHandler()
@@ -41,7 +41,7 @@ def env(pytestconfig) -> H2TestEnv:
return env
-@pytest.fixture(autouse=True, scope="module")
+@pytest.fixture(autouse=True, scope="package")
def _session_scope(env):
yield
assert env.apache_stop() == 0
Added: httpd/httpd/trunk/test/modules/http2/test_501_proxy_serverheader.py
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/test/modules/http2/test_501_proxy_serverheader.py?rev=1894190&view=auto
==============================================================================
--- httpd/httpd/trunk/test/modules/http2/test_501_proxy_serverheader.py (added)
+++ httpd/httpd/trunk/test/modules/http2/test_501_proxy_serverheader.py Wed Oct 13 12:26:21 2021
@@ -0,0 +1,35 @@
+import pytest
+
+from .env import H2Conf
+
+
+class TestStore:
+
+ @pytest.fixture(autouse=True, scope='class')
+ def _class_scope(self, env):
+ conf = H2Conf(env)
+ conf.add_vhost_cgi(proxy_self=True, h2proxy_self=False, extras={
+ f'cgi.{env.http_tld}': f"""
+ Header unset Server
+ Header always set Server cgi
+ """
+ })
+ conf.install()
+ assert env.apache_restart() == 0
+
+ def setup_method(self, method):
+ print("setup_method: %s" % method.__name__)
+
+ def teardown_method(self, method):
+ print("teardown_method: %s" % method.__name__)
+
+ def test_h2_501_01(self, env):
+ url = env.mkurl("https", "cgi", "/proxy/hello.py")
+ r = env.curl_get(url, 5)
+ assert 200 == r.response["status"]
+ assert "HTTP/1.1" == r.response["json"]["protocol"]
+ assert "" == r.response["json"]["https"]
+ assert "" == r.response["json"]["ssl_protocol"]
+ assert "" == r.response["json"]["h2"]
+ assert "" == r.response["json"]["h2push"]
+ assert "cgi" == r.response["header"]["server"]