Files
apache-http-server/test/modules/tls/test_16_proxy_mixed.py
Jean-Frederic Clere d958349e72 Arrange pytest to run with mod_ssl, still skipping some tests.
this closes #433


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1917039 13f79535-47bb-0310-9956-ffa450edef68
2024-04-16 15:02:29 +00:00

51 lines
1.7 KiB
Python

import time
import pytest
from .conf import TlsTestConf
from pyhttpd.env import HttpdTestEnv
@pytest.mark.skipif(condition=not HttpdTestEnv.has_shared_module("tls"), reason="no mod_tls available")
class TestProxyMixed:
@pytest.fixture(autouse=True, scope='class')
def _class_scope(self, env):
conf = TlsTestConf(env=env, extras={
'base': [
"LogLevel proxy:trace1 proxy_http:trace1 ssl:trace1 proxy_http2:trace1 http2:debug",
"ProxyPreserveHost on",
],
env.domain_a: [
"Protocols h2 http/1.1",
"TLSProxyEngine on",
f"TLSProxyCA {env.ca.cert_file}",
"<Location /proxy-tls/>",
f" ProxyPass h2://127.0.0.1:{env.https_port}/",
"</Location>",
],
env.domain_b: [
"SSLProxyEngine on",
"SSLProxyVerify require",
f"SSLProxyCACertificateFile {env.ca.cert_file}",
"<Location /proxy-ssl/>",
f" ProxyPass https://127.0.0.1:{env.https_port}/",
"</Location>",
],
})
# add vhosts a+b and a ssl proxy from a to b
conf.add_tls_vhosts(domains=[env.domain_a, env.domain_b])
conf.install()
assert env.apache_restart() == 0
def test_tls_16_proxy_mixed_ssl_get(self, env, repeat):
data = env.tls_get_json(env.domain_b, "/proxy-ssl/index.json")
assert data == {'domain': env.domain_b}
def test_tls_16_proxy_mixed_tls_get(self, env, repeat):
data = env.tls_get_json(env.domain_a, "/proxy-tls/index.json")
if data is None:
time.sleep(300)
assert data == {'domain': env.domain_a}