Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Commit 81a8257

Browse files
committed
TLS for HTTP/1.1
1 parent f74c914 commit 81a8257

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

hyper/http11/connection.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import socket
1111

1212
from .response import HTTP11Response
13+
from ..tls import wrap_socket, H2_NPN_PROTOCOLS
1314
from ..http20.bufsocket import BufferedSocket
1415
from ..common.headers import HTTPHeaderMap
1516
from ..common.util import to_bytestring
@@ -71,6 +72,11 @@ def connect(self):
7172
"""
7273
if self._sock is None:
7374
sock = socket.create_connection((self.host, self.port), 5)
75+
76+
if self.secure:
77+
sock, proto = wrap_socket(sock, self.host)
78+
assert proto not in H2_NPN_PROTOCOLS
79+
7480
self._sock = BufferedSocket(sock, self.network_buffer_size)
7581

7682
return

0 commit comments

Comments
 (0)