Commit Graph

106 Commits

Author SHA1 Message Date
Saiyang Gou 927b841c21
bpo-37363: Add audit events to the `http.client` module (GH-21321)
Add audit events to the `http.client` module

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2021-04-23 12:19:08 +02:00
Christian Heimes f97406be4c
bpo-40968: Send http/1.1 ALPN extension (#20959)
Signed-off-by: Christian Heimes <christian@python.org>
2020-11-13 16:37:52 +01:00
James Corbett b94737a4af
fixes typos in http.client documentation (#18300) 2020-02-01 04:31:00 -08:00
Simon Legner 112f2b805b Update the URL for the requests package (GH-17006)
Change the url from docs.python-requests.org to requests.readthedocs.io
2019-10-31 05:01:44 -07:00
Ashwin Ramaswami ff2e182865 bpo-12707: deprecate info(), geturl(), getcode() methods in favor of headers, url, and status properties for HTTPResponse and addinfourl (GH-11447)
Co-Authored-By: epicfaace <aramaswamis@gmail.com>
2019-09-13 12:40:07 +01:00
Julien Palard e1d455f3a3 Doc: Use walrus operator in example. (GH-15934) 2019-09-11 15:01:18 +02:00
Ashwin Ramaswami 62cf698142 bpo-35649: update http client example (GH-11441) 2019-09-11 14:41:54 +02:00
Christian Heimes d1bd6e79da bpo-37440: Enable TLS 1.3 post-handshake auth in http.client (GH-14448)
Post-handshake authentication is required for conditional client cert authentication with TLS 1.3.


https://bugs.python.org/issue37440
2019-06-30 23:32:24 -07:00
Ashwin Ramaswami 478f829132 bpo-21257: document http.client.parse_headers (GH-11443)
Document http.client.parse_headers
2019-01-18 08:49:16 -07:00
Xtreak f0af4c54e3 bpo-33830: Fix an example in http.client docs for 404. (GH-7780) 2018-12-21 17:34:41 +02:00
Nir Soffer ad455cd924 bpo-31945: Configurable blocksize in HTTP(S)Connection (#4279)
blocksize was hardcoded to 8192, preventing efficient upload when using
file-like body. Add blocksize argument to __init__, so users can
configure the blocksize to fit their needs.

I tested this uploading data from /dev/zero to a web server dropping the
received data, to test the overhead of the HTTPConnection.send() with a
file-like object.

Here is an example 10g upload with the default buffer size (8192):

$ time ~/src/cpython/release/python upload-httplib.py 10 https://localhost:8000/
Uploaded 10.00g in 17.53 seconds (584.00m/s)

real	0m17.574s
user	0m8.887s
sys	0m5.971s

Same with 512k blocksize:

$ time ~/src/cpython/release/python upload-httplib.py 10 https://localhost:8000/
Uploaded 10.00g in 6.60 seconds (1551.15m/s)

real	0m6.641s
user	0m3.426s
sys	0m2.162s

In real world usage the difference will be smaller, depending on the
local and remote storage and the network.

See https://github.com/nirs/http-bench for more info.
2017-11-06 13:16:37 -08:00
Serhiy Storchaka 2e576f5aec bpo-30144: Import collections ABC from collections.abc rather than collections. (#1263) 2017-04-24 09:05:00 +03:00
Andrew Kuchling bafd4f2560 Merge from 3.5 2016-11-08 22:38:54 -05:00
Andrew Kuchling 58c534dd6c Use http instead of https, due to certificate error 2016-11-08 22:33:31 -05:00
Andrew Kuchling 9a7aff521e Merge from 3.5 2016-11-08 22:14:39 -05:00
Andrew Kuchling d58fc8b89e Update URL for requests documentation after IRC request 2016-11-08 22:07:43 -05:00
Christian Heimes d04863771b Issue #28022: Deprecate ssl-related arguments in favor of SSLContext.
The deprecation include manual creation of SSLSocket and certfile/keyfile
(or similar) in ftplib, httplib, imaplib, smtplib, poplib and urllib.

ssl.wrap_socket() is not marked as deprecated yet.
2016-09-10 23:23:33 +02:00
Senthil Kumaran 10427f4485 [merge from 3.5] - Issue28010 - Make http.client.HTTPConnection.putrequest
documentation consistent with the code.
2016-09-08 14:29:23 -07:00
Senthil Kumaran 5dc504c3c9 Issue28010 - Make http.client.HTTPConnection.putrequest documentation consistent with the code. 2016-09-08 14:28:01 -07:00
Martin Panter ef91bb2660 Issue #12319: Always send file request bodies using chunked encoding
The previous attempt to determine the file’s Content-Length gave a false
positive for pipes on Windows.

Also, drop the special case for sending zero-length iterable bodies.
2016-08-27 01:39:26 +00:00
Martin Panter 3c0d0baf2b Issue #12319: Support for chunked encoding of HTTP request bodies
When the body object is a file, its size is no longer determined with
fstat(), since that can report the wrong result (e.g. reading from a pipe).
Instead, determine the size using seek(), or fall back to chunked encoding
for unseekable files.

Also, change the logic for detecting text files to check for TextIOBase
inheritance, rather than inspecting the “mode” attribute, which may not
exist (e.g. BytesIO and StringIO).  The Content-Length for text files is no
longer determined ahead of time, because the original logic could have been
wrong depending on the codec and newline translation settings.

Patch by Demian Brecht and Rolf Krahl, with a few tweaks by me.
2016-08-24 06:33:33 +00:00
Martin Panter 540f0451d2 Correct misspellings of ISO-8859 2016-08-10 05:25:16 +00:00
Terry Jan Reedy fa089b9b0b Issue #22558: Add remaining doc links to source code for Python-coded modules.
Reformat header above separator line (added if missing) to a common format.
Patch by Yoni Lavi.
2016-06-11 15:02:54 -04:00
Martin Panter fe289c0f6f Issue #26553: Capitalization of HTTP, HTTPS, FTP, and URL
Patch by Anish Shah and Aatish Neupane.
2016-05-28 02:20:39 +00:00
Serhiy Storchaka dba903993a Issue #23921: Standardized documentation whitespace formatting.
Original patch by James Edwards.
2016-05-10 12:01:23 +03:00
Martin Panter ce911c3fed Issue #26499: Fixes to HTTPResponse.readline() and read1(), by Silent Ghost 2016-03-17 06:42:48 +00:00
Georg Brandl 5d94134040 Closes #25910: fix dead and permanently redirected links in the docs. Thanks to SilentGhost for the patch. 2016-02-26 19:37:12 +01:00
Benjamin Peterson b174b85c1a merge 3.4 (#24118) 2015-05-03 13:00:37 -04:00
Benjamin Peterson ac87ed7e9f update example, since python.org is HTTPS-only now (closes #24118) 2015-05-03 12:59:09 -04:00
Benjamin Peterson d19458ac51 merge 3.4 (#23989) 2015-04-20 18:22:21 -04:00
Benjamin Peterson 6de708fd46 recommend requests library (closes #23989)
Patch from Van Lindberg
2015-04-20 18:18:14 -04:00
R David Murray cae7bdb424 #3566: Clean up handling of remote server disconnects.
This changeset does two things: introduces a new RemoteDisconnected exception
(that subclasses ConnectionResetError and BadStatusLine) so that a remote
server disconnection can be detected by client code (and provides a better
error message for debugging purposes), and ensures that the client socket is
closed if a ConnectionError happens, so that the automatic re-connection code
can work if the application handles the error and continues on.

Tests are added that confirm that a connection is re-used or not re-used
as appropriate to the various combinations of protocol version and headers.

Patch by Martin Panter, reviewed by Demian Brecht.  (Tweaked only slightly by
me.)
2015-04-05 19:26:29 -04:00
R David Murray 0a0d20edfb Merge: #23539: Set Content-Length to 0 for PUT, POST, and PATCH if body is None. 2015-03-22 15:19:01 -04:00
R David Murray beed8402ca #23539: Set Content-Length to 0 for PUT, POST, and PATCH if body is None.
Some http servers will reject PUT, POST, and PATCH requests if they
do not have a Content-Length header.

Patch by James Rutherford, with additional cleaning up of the
'request' documentation by me.
2015-03-22 15:18:23 -04:00
Berker Peksag 8e28679417 Issue #23439: Add missing entries to http.client.__all__.
Also, document the LineTooLong exception since it can be raised by
the members of public API (e.g. http.client.HTTPResponse).

Patch by Martin Panter.
2015-02-20 09:45:05 +02:00
Berker Peksag babc688180 Issue #23439: Add missing entries to http.client.__all__.
Also, document the LineTooLong exception since it can be raised by
the members of public API (e.g. http.client.HTTPResponse).

Patch by Martin Panter.
2015-02-20 09:39:38 +02:00
Berker Peksag cb18b95ab8 Issue #20898: Add a "HTTP status codes" section to avoid duplication in HTTP docs.
This commit also removes a couple of non-standard status codes. They were
added as part of edf669b13482, so there is no backwards compatibility issue.

Patch by Demian Brecht.
2015-01-20 06:30:46 +02:00
Benjamin Peterson e3b743cd3e fix reference by adding module name 2014-12-07 17:26:38 -05:00
Benjamin Peterson a090f01bb6 HTTPSConnection: prefer the context's check_hostname attribute over the constructor parameter (#22959) 2014-12-07 13:18:25 -05:00
Benjamin Peterson 4ffb075271 PEP 476: enable HTTPS certificate verification by default (#22417)
Patch by Alex Gaynor with some modifications by me.
2014-11-03 14:29:33 -05:00
Senthil Kumaran 8b4a272c98 Correct the URL in the http.client example. Noted by Evens Fortuné. Closes #21229 2014-04-16 23:33:02 -04:00
Antoine Pitrou c5e075ff03 Issue #20913: improve the SSL security considerations to first advocate using create_default_context(). 2014-03-22 18:19:11 +01:00
Benjamin Peterson 2221f666eb merge 3.3 (#11448) 2014-03-16 15:56:24 -05:00
Benjamin Peterson a48d9eaa5c improve set_tunnel docs (closes #11448)
Patch by Ryan Kelly, karl, and Nikolaus Rath.
2014-03-16 15:55:39 -05:00
R David Murray 0056936a4b whatsnew: deprecation of HTTPConnection's strict parameter. 2014-01-03 13:04:25 -05:00
Serhiy Storchaka 0e90e99188 Issue #19795: Improved markup of True/False constants. 2013-11-29 12:19:53 +02:00
Serhiy Storchaka fbc1c26803 Issue #19795: Improved markup of True/False constants. 2013-11-29 12:17:13 +02:00
Georg Brandl bf3f8eb960 Issue #16037: HTTPMessage.readheaders() raises an HTTPException when more than
100 headers are read.  Adapted from patch by Jyrki Pulliainen.
2013-10-27 07:34:48 +01:00
Georg Brandl b89b5df9c9 merge with 3.3 2013-10-27 07:46:09 +01:00
Georg Brandl 92666d9c2b merge with 3.3 2013-10-06 12:42:40 +02:00