diff options
Diffstat (limited to 'Lib/http/client.py')
-rw-r--r-- | Lib/http/client.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/http/client.py b/Lib/http/client.py index 08cf2ed..a6ab135 100644 --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -70,6 +70,7 @@ Req-sent-unread-response _CS_REQ_SENT <response_class> import email.parser import email.message +import errno import http import io import re @@ -939,7 +940,12 @@ class HTTPConnection: sys.audit("http.client.connect", self, self.host, self.port) self.sock = self._create_connection( (self.host,self.port), self.timeout, self.source_address) - self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) + # Might fail in OSs that don't implement TCP_NODELAY + try: + self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) + except OSError as e: + if e.errno != errno.ENOPROTOOPT: + raise if self._tunnel_host: self._tunnel() |