}
}
+#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,
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,
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);
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()
return env
-@pytest.fixture(autouse=True, scope="module")
+@pytest.fixture(autouse=True, scope="package")
def _session_scope(env):
yield
assert env.apache_stop() == 0
metafunc.parametrize('repeat', range(count))
-@pytest.fixture(scope="module")
+@pytest.fixture(scope="package")
def env(pytestconfig) -> H2TestEnv:
level = logging.INFO
console = logging.StreamHandler()
return env
-@pytest.fixture(autouse=True, scope="module")
+@pytest.fixture(autouse=True, scope="package")
def _session_scope(env):
yield
assert env.apache_stop() == 0
--- /dev/null
+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"]