Files
ladybird/Ports/python3/patches/http-client.patch
Rodrigo Tobar c38c93bff1 Ports: Patch Python's http.client due to unimplemented socket option
This problem has been reported on https://bugs.python.org/issue45328 and
a fix has been provided, potential review and merge are pending.
2021-10-06 13:57:52 +01:00

25 lines
849 B
Diff

--- Python-3.10/Lib/http/client.py 2021-09-07 21:18:28.000000000 +0800
+++ Python-3.10/Lib/http/client.py 2021-09-30 10:22:31.513921004 +0800
@@ -70,6 +70,7 @@
import email.parser
import email.message
+import errno
import http
import io
import re
@@ -939,7 +940,12 @@
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()