summaryrefslogtreecommitdiffstats
path: root/test/modules/http2/test_501_proxy_serverheader.py
blob: d78db1a6d84b50bb668ab7ac0dd317f5035153c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import pytest

from .env import H2Conf


class TestProxyServerHeader:

    @pytest.fixture(autouse=True, scope='class')
    def _class_scope(self, env):
        conf = H2Conf(env, extras={
            f'cgi.{env.http_tld}': [
                "Header unset Server",
                "Header always set Server cgi",
            ]
        })
        conf.add_vhost_cgi(proxy_self=True, h2proxy_self=False)
        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 r.response["status"] == 200
        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"]