[downloader:http] add 'consume-content' option

* fix connection not being released when the response is neither
  successful nor retried
* add the ability to consume the HTTP response body instead of closing
  the connection

reference:

https://docs.python-requests.org/en/latest/user/advanced/#body-content-workflow
This commit is contained in:
ClosedPort22
2023-03-09 20:55:28 +08:00
parent c9a7345228
commit df77271438
2 changed files with 35 additions and 1 deletions

View File

@@ -3616,6 +3616,25 @@ Description
contains JPEG/JFIF data.
downloader.http.consume-content
---------------------------------
Type
``bool``
Default
``false``
Description
Controls the behavior when an HTTP response is considered
unsuccessful
If the value is ``true``, consume the response body. This
avoids closing the connection and therefore improves connection
reuse.
If the value is ``false``, immediately close the connection
without reading the response. This can be useful if the server
is known to send large bodies for error responses.
downloader.http.chunk-size
--------------------------
Type