Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions test/modules/ssl/test_003_verify_client_perdir.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,36 @@ def test_ssl_003_06(self, env, proto, version):
assert not (r.exit_code == 0 and r.response
and r.response["status"] == 200), \
"certificate accepted at SSLVerifyDepth 0"


# SSLVerifyClient can also be configured where no SSL is in play at all:
# a plain-HTTP vhost. mod_ssl's access hook then finds no SSL context and
# must decline rather than dereference it.
class TestVerifyClientNonSSL:

@pytest.fixture(autouse=True, scope='class')
@classmethod
def _class_scope(cls, env):
conf = HttpdConf(env, extras={
f"test1.{env.http_tld}": """
<Location /ssl-vars>
SSLVerifyClient require
</Location>
""",
})
conf.add_vhost_test1()
conf.install()
assert env.apache_restart() == 0

# A plain HTTP request to the location must be answered, not crash
# the connection; the location has no resource, so the answer is 404.
def test_ssl_003_07_no_crash_non_ssl(self, env):
url = env.mkurl("http", "test1", "/ssl-vars/")
r = env.curl_get(url)
assert r.exit_code == 0, f"curl failed: {r.stderr}"
assert r.response["status"] == 404, \
f"unexpected status {r.response['status']}"
# The server is still alive afterwards.
r2 = env.curl_get(env.mkurl("http", "test1", "/index.html"))
assert r2.exit_code == 0
assert r2.response["status"] == 200
Loading