summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--test/test_tls_sni.py20
-rw-r--r--test/unit/http.py2
2 files changed, 21 insertions, 1 deletions
diff --git a/test/test_tls_sni.py b/test/test_tls_sni.py
index 2e5424e2..eba6140a 100644
--- a/test/test_tls_sni.py
+++ b/test/test_tls_sni.py
@@ -168,6 +168,26 @@ basicConstraints = critical,CA:TRUE"""
self.check_cert('alt2.example.com', bundles['example.com']['subj'])
self.check_cert('blah', bundles['default']['subj'])
+ def test_tls_sni_no_hostname(self):
+ bundles = {
+ "localhost.com": {"subj": "localhost.com", "alt_names": []},
+ "example.com": {
+ "subj": "example.com",
+ "alt_names": ["example.com"],
+ },
+ }
+ self.config_bundles(bundles)
+ self.add_tls(["localhost.com", "example.com"])
+
+ resp, sock = self.get_ssl(
+ headers={'Content-Length': '0', 'Connection': 'close'}, start=True,
+ )
+ assert resp['status'] == 200
+ assert (
+ sock.getpeercert()['subject'][0][0][1]
+ == bundles['localhost.com']['subj']
+ )
+
def test_tls_sni_upper_case(self):
bundles = {
"localhost.com": {"subj": "LOCALHOST.COM", "alt_names": []},
diff --git a/test/unit/http.py b/test/unit/http.py
index 797b7681..dcfcd232 100644
--- a/test/unit/http.py
+++ b/test/unit/http.py
@@ -45,7 +45,7 @@ class TestHTTP:
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
if 'wrapper' in kwargs:
- server_hostname = headers.get('Host', 'localhost')
+ server_hostname = headers.get('Host', None)
sock = kwargs['wrapper'](sock, server_hostname=server_hostname)
connect_args = addr if sock_type == 'unix' else (addr, port)