summaryrefslogtreecommitdiff
blob: b7cbf9bb7e9e8a1914312c24873cb88b85e1f3ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From 14bcf7004a143f7a6fb2df9a48196a113d531f50 Mon Sep 17 00:00:00 2001
From: Seth Michael Larson <sethmichaellarson@gmail.com>
Date: Tue, 1 Dec 2020 20:09:32 -0600
Subject: [PATCH] Switch to Brotli C bindings for CPython, brotlicffi for
 non-CPython

---
 setup.cfg                   | 3 ++-
 setup.py                    | 5 ++++-
 src/urllib3/response.py     | 5 ++++-
 src/urllib3/util/request.py | 5 ++++-
 7 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/setup.cfg b/setup.cfg
index 90b79d8c5..31a465b58 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -15,7 +15,7 @@ requires-dist =
     idna>=2.0.0; extra == 'secure'
     certifi; extra == 'secure'
     PySocks>=1.5.6,<2.0,!=1.5.7; extra == 'socks'
-    brotlipy>=0.6.0; extra == 'brotli'
+    brotlicffi>=0.8.0; extra == 'brotli'
 
 [tool:pytest]
 xfail_strict = true
diff --git a/setup.py b/setup.py
index 2d449b095..02071aa58 100755
--- a/setup.py
+++ b/setup.py
@@ -109,7 +109,7 @@
     requires=[],
     python_requires=">=3.6, <4",
     extras_require={
-        "brotli": ["brotlipy>=0.6.0"],
+        "brotli": ["brotlicffi>=0.8.0"],
         "secure": [
             "pyOpenSSL>=0.14",
             "cryptography>=1.3.4",
diff --git a/src/urllib3/response.py b/src/urllib3/response.py
index 77b6ffc16..d277120ee 100644
--- a/src/urllib3/response.py
+++ b/src/urllib3/response.py
@@ -7,7 +7,7 @@
 from socket import timeout as SocketTimeout
 
 try:
-    import brotli
+    import brotlicffi as brotli
 except ImportError:
     brotli = None
 
diff --git a/src/urllib3/util/request.py b/src/urllib3/util/request.py
index 6cbdad9b4..64d40641d 100644
--- a/src/urllib3/util/request.py
+++ b/src/urllib3/util/request.py
@@ -11,7 +11,7 @@
 
 ACCEPT_ENCODING = "gzip,deflate"
 try:
-    import brotli as _unused_module_brotli  # noqa: F401
+    import brotlicffi as _unused_module_brotli  # noqa: F401
 except ImportError:
     pass
 else: