@pytest.fixture(autouse=True, scope='class') def _class_scope(self, env): # setup 3 vhosts on https: for reverse, forward and # mixed proxying to a unix: domain socket # We setup a UDSFaker running that returns a fixed response
UDS_PATH = f"{env.gen_dir}/proxy_02.sock"
TestProxyUds.UDS_PATH = UDS_PATH
faker = UDSFaker(path=UDS_PATH)
faker.start()
@pytest.mark.parametrize(["via", "seen"], [
["reverse", "faked"],
["mixed", "faked"],
]) def test_proxy_02_001(self, env, via, seen): # make requests to a reverse proxy https: vhost to the http: vhost # check that we see the document we expect there (host matching worked)
r = env.curl_get(f"https://{via}.{env.http_tld}:{env.https_port}/alive.json", 5) assert r.response["status"] == 200 assert r.json['host'] == seen
@pytest.mark.parametrize(["via", "seen"], [
["forward", "generic"],
["mixed", "faked"],
]) def test_proxy_02_002(self, env, via, seen): # make requests to a forward proxy https: vhost to the http: vhost # check that we see the document we expect there (host matching worked) # we need to explicitly provide a Host: header since mod_proxy cannot # resolve the name via DNS. ifnot env.curl_is_at_least('8.0.0'):
pytest.skip(f'need at least curl v8.0.0 for this')
domain = f"{via}.{env.http_tld}"
r = env.curl_get(f"http://127.0.0.1:{env.http_port}/alive.json", 5, options=[ '-H', f"Host: {domain}", '--proxy', f"https://{domain}:{env.https_port}/", '--resolve', f"{domain}:{env.https_port}:127.0.0.1", '--proxy-cacert', f"{env.get_ca_pem_file(domain)}",
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.