mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
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.
This commit is contained in:
parent
e02c843af4
commit
c38c93bff1
2 changed files with 28 additions and 0 deletions
|
@ -16,6 +16,10 @@ Enforce UTF-8 as encoding by defining `_Py_FORCE_UTF8_LOCALE`.
|
|||
|
||||
As usual, make the `configure` script recognize Serenity. Also set `MACHDEP` (which is used for `sys.platform`) to a version-less `serenityos`, even when not cross-compiling.
|
||||
|
||||
## `http-client.patch`
|
||||
|
||||
Allows HTTPConnection to work without the TCP_NODELAY socket option, as this is not supported by Serenity.
|
||||
|
||||
## `tweak-setup-py.patch`
|
||||
|
||||
Make some tweaks to Python's `setup.py` files:
|
||||
|
|
24
Ports/python3/patches/http-client.patch
Normal file
24
Ports/python3/patches/http-client.patch
Normal file
|
@ -0,0 +1,24 @@
|
|||
--- 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()
|
Loading…
Add table
Add a link
Reference in a new issue