You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Added**
- TransferProgress tracking in Response when downloading using
`stream=True` based on the Content-Length. (#127) There's no easy way to
track the "real" amount of bytes consumed using "iter_content" when the
remote is sending a compressed body. This change makes it possible to
track the amount of bytes consumed. The `Response` object now contain a
property named `download_progress` that is either `None` or a
`TransferProgress` object.
- HTTP/2 with prior knowledge over TLS or via an unencrypted connection.
`disable_http1` toggle is now available through your `Session`
constructor. In consequence, you may leverage all HTTP/2 capabilities
like multiplexing using a plain (e.g. non-TLS) socket. You may
enable/disable any protocols per Session object (but not all of them at
once!). In non-TLS connections, you have to keep one of HTTP/1.1 or
HTTP/2 enabled. Otherwise, one of HTTP/1.1, HTTP/2 or HTTP/3. A
`RuntimeError` may be thrown if no protocol can be used in a given
context.
**Changed**
- Relax main API constraint in get, head, options and delete methods /
functions by accepting kwargs.
- urllib3-future lower bound version is raised to 2.8.900
Copy file name to clipboardexpand all lines: docs/user/advanced.rst
+56-3
Original file line number
Diff line number
Diff line change
@@ -1299,21 +1299,37 @@ by passing a custom ``QuicSharedCache`` instance like so::
1299
1299
1300
1300
When the cache is full, the oldest entry is removed.
1301
1301
1302
-
Disable HTTP/2, and/or HTTP/3
1302
+
Disable HTTP/1.1, HTTP/2, and/or HTTP/3
1303
1303
-----------------------------
1304
1304
1305
1305
You can at your own discretion disable a protocol by passing ``disable_http2=True`` or
1306
1306
``disable_http3=True`` within your ``Session`` constructor.
1307
1307
1308
-
.. warning:: It is actually forbidden to disable HTTP/1.1 as the underlying library (urllib3.future) does not permit it for now.
1309
-
1310
1308
Having a session without HTTP/2 enabled should be done that way::
1311
1309
1312
1310
import niquests
1313
1311
1314
1312
session = niquests.Session(disable_http2=True)
1315
1313
1316
1314
1315
+
HTTP/2 with prior knowledge
1316
+
---------------------------
1317
+
1318
+
Interacting with a server over plain text using the HTTP/2 protocol must be done by
1319
+
disabling HTTP/1.1 entirely, so that Niquests knows that you know in advance what the remote is capable of.
1320
+
1321
+
Following this example::
1322
+
1323
+
import niquests
1324
+
1325
+
session = niquests.Session(disable_http1=True)
1326
+
r = session.get("http://my-special-svc.local")
1327
+
r.version # 20 (aka. HTTP/2)
1328
+
1329
+
.. note:: You may do the same for servers that do not support the ALPN extension for https URLs.
1330
+
1331
+
.. warning:: Disabling HTTP/1.1 and HTTP/2 will raise an error (RuntimeError) for non https URLs! As HTTP/3 is designed for the QUIC layer, which itself is based on TLS 1.3.
0 commit comments