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

Commit 329372f

Browse files
committed
Only send HTTP upgrade headers on first request
1 parent 4bdeb54 commit 329372f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

hyper/http11/connection.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ def __init__(self, host, port=None, secure=None, ssl_context=None,
6969
else:
7070
self.secure = False
7171

72+
self._send_http_upgrade = not self.secure
73+
7274
self.ssl_context = ssl_context
7375
self._sock = None
7476

@@ -131,9 +133,10 @@ def request(self, method, url, body=None, headers={}):
131133

132134
if self._sock is None:
133135
self.connect()
134-
135-
# TODO: Only send upgrade headers on first request
136-
self._add_upgrade_headers(headers)
136+
137+
if(self._send_http_upgrade):
138+
self._add_upgrade_headers(headers)
139+
self._send_http_upgrade = False
137140

138141
# We may need extra headers.
139142
if body:

0 commit comments

Comments
 (0)