Skip to content

Commit 29bf757

Browse files
mupufluoyaoming
authored andcommitted
Inherit HTTPConnection through urllib3.connection, not httplib
Origin: upstream, msabramo/requests-unixsocket#69 Bug: msabramo/requests-unixsocket#70 Bug-Ubuntu: https://launchpad.net/bugs/2053016 Bug-Debian: https://bugs.debian.org/1063892 Applied-Upstream: no Last-Update: 2024-02-14 By inheriting from `urllib3.connection.HTTPConnection` (that inherits from `httplib.HTTPConnection` itself), we can adapt to the internal changes in urllib3 2.0 that added a `request()` method that is incompatible with httplib.HTTPConnection.request. This fixes the incompatibility between urllib3 2.0 and requests 1.26+, which was the first version that stopped vendoring urllib3. Reference: docker/docker-py#3113 (comment) Fixes: #70 Last-Update: 2024-02-14 Gbp-Pq: Name 0001-Inherit-HTTPConnection-through-urllib3.connection-no.patch
1 parent be8caca commit 29bf757

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

requests_unixsocket/adapters.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
from requests.adapters import HTTPAdapter
44
from requests.compat import urlparse, unquote
55

6-
try:
7-
import http.client as httplib
8-
except ImportError:
9-
import httplib
10-
116
try:
127
from requests.packages import urllib3
138
except ImportError:
@@ -16,7 +11,7 @@
1611

1712
# The following was adapted from some code from docker-py
1813
# https://github.com/docker/docker-py/blob/master/docker/transport/unixconn.py
19-
class UnixHTTPConnection(httplib.HTTPConnection, object):
14+
class UnixHTTPConnection(urllib3.connection.HTTPConnection, object):
2015

2116
def __init__(self, unix_socket_url, timeout=60):
2217
"""Create an HTTP connection to a unix domain socket

0 commit comments

Comments
 (0)