summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_httplib.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-38216, bpo-36274: Allow subclasses to separately override validation and ↵Jason R. Coombs2019-09-281-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | encoding behavior (GH-16448) * bpo-38216: Allow bypassing input validation * bpo-36274: Also allow the URL encoding to be overridden. * bpo-38216, bpo-36274: Add tests demonstrating a hook for overriding validation, test demonstrating override encoding, and a test to capture expectation of the interface for the URL. * Call with skip_host to avoid tripping on the host checking in the URL. * Remove obsolete comment. * Make _prepare_path_encoding its own attr. This makes overriding just that simpler. Also, don't use the := operator to make backporting easier. * Add a news entry. * _prepare_path_encoding -> _encode_prepared_path() * Once again separate the path validation and request encoding, drastically simplifying the behavior. Drop the guarantee that all processing happens in _prepare_path.
* bpo-26589: Add http status code 451 (GH-15413)Raymond Hettinger2019-08-231-0/+1
|
* bpo-37795: Capture DeprecationWarnings in the test suite (GH-15184)Pablo Galindo2019-08-081-2/+6
|
* bpo-37440: Enable TLS 1.3 post-handshake auth in http.client (GH-14448)Christian Heimes2019-07-011-0/+18
| | | | | | Post-handshake authentication is required for conditional client cert authentication with TLS 1.3. https://bugs.python.org/issue37440
* bpo-35925: Skip SSL tests that fail due to weak external certs. (GH-13124)Gregory P. Smith2019-05-061-4/+21
| | | | | | | | Modern Linux distros such as Debian Buster have default OpenSSL system configurations that reject connections to servers with weak certificates by default. This causes our test suite run with external networking resources enabled to skip these tests when they encounter such a failure. Fixing the network servers is a separate issue.
* bpo-35934: Add socket.create_server() utility function (GH-11784)Giampaolo Rodola2019-04-081-4/+1
|
* bpo-36522: Print all values for headers with multiple values. (GH-12681)Matt Houglum2019-04-041-2/+4
|
* bpo-33365: print the header values beside the keys (GH-6611)Marco Strigl2018-06-191-0/+15
| | | | | with debuglevel=1 only the header keys got printed. With this change the header values get printed as well and the single header entries get '\n' as a separator.
* bpo-30399: Get rid of trailing comma in the repr of BaseException. (#1650)Serhiy Storchaka2017-11-151-1/+1
|
* bpo-31945: Configurable blocksize in HTTP(S)Connection (#4279)Nir Soffer2017-11-061-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* bpo-30553: Add status code 421 to http.HTTPStatus (GH-2589)Vitor Pereira2017-10-261-0/+1
|
* Trivial cleanups following bpo-31370 (#3649)Antoine Pitrou2017-09-181-2/+1
| | | | | | * Trivial cleanups following bpo-31370 * Also cleanup the "importlib._bootstrap_external" module
* bpo-31346: Use PROTOCOL_TLS_CLIENT/SERVER (#3058)Christian Heimes2017-09-151-9/+6
| | | | | | Replaces PROTOCOL_TLSv* and PROTOCOL_SSLv23 with PROTOCOL_TLS_CLIENT and PROTOCOL_TLS_SERVER. Signed-off-by: Christian Heimes <christian@python.org>
* Issue #28394: Merge typo fixes from 3.5 into 3.6Martin Panter2016-10-101-1/+1
|\
| * Issue #28394: Spelling and typo fixes in code comments and changelogMartin Panter2016-10-101-1/+1
| | | | | | | | Includes patch by Ville Skyttä.
* | Issue 28022: Catch deprecation warning in test_httplib, reported by Martin ↵Christian Heimes2016-09-111-6/+9
| | | | | | | | Panter
* | Merge: #22233: Only split headers on \r and/or \n, per email RFCs.R David Murray2016-09-071-0/+30
|\ \ | |/
| * #22233: Only split headers on \r and/or \n, per email RFCs.R David Murray2016-09-071-0/+30
| | | | | | | | Original patch by Martin Panter, new policy fixes by me.
* | Issue #12319: Always send file request bodies using chunked encodingMartin Panter2016-08-271-8/+19
| | | | | | | | | | | | | | 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.
* | Issue #12319: Support for chunked encoding of HTTP request bodiesMartin Panter2016-08-241-4/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Issue #27787: No longer call deleted test_main().Terry Jan Reedy2016-08-231-1/+1
| |
* | Issue #27787: Remove test_main() and hard-coded list of test classesMartin Panter2016-08-231-9/+2
|/ | | | | | The @reap_threads decorator made the test wait (for up to 1 s) until background threads have finished. Calling join() with a timeout should be equivalent.
* Close HTTP connections and responses in tests to avoid ResourceWarningsMartin Panter2016-08-121-1/+11
|
* Issue #27125: Fix various errors like “will [be] inherited”Martin Panter2016-05-291-2/+2
|
* Issue #21069: Move test_fileno() from test_urllibnet and rewrite itMartin Panter2016-04-091-0/+41
| | | | | | | | * No longer attempts to close already freed socket file descriptor * Use socket object to be compatible with Windows * Do not use a timeout to avoid complication with non-blocking mode * Use internal localhost server rather than depending on a third party * Avoid trouble with buffered HTTP data by testing tunnelled CONNECT data
* Issue #26499: Fixes to HTTPResponse.readline() and read1(), by Silent GhostMartin Panter2016-03-171-9/+70
|
* Issue #26045: Add UTF-8 suggestion to error in http.clientMartin Panter2016-02-091-1/+1
| | | | Based on patch by Guido van Rossum.
* #3566: Clean up handling of remote server disconnects.R David Murray2015-04-051-1/+91
| | | | | | | | | | | | | | | 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.)
* Merge: #23539: Set Content-Length to 0 for PUT, POST, and PATCH if body is None.R David Murray2015-03-221-15/+54
|\
| * #23539: Set Content-Length to 0 for PUT, POST, and PATCH if body is None.R David Murray2015-03-221-15/+54
| | | | | | | | | | | | | | | | 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.
* | Issue #22928: Disabled HTTP header injections in http.client.Serhiy Storchaka2015-03-121-0/+57
|\ \ | |/ | | | | Original patch by Demian Brecht.
| * Issue #22928: Disabled HTTP header injections in http.client.Serhiy Storchaka2015-03-121-0/+57
| | | | | | | | Original patch by Demian Brecht.
* | Merge 3.4 (httplib)Victor Stinner2015-02-271-0/+3
|\ \ | |/
| * Issue #23526: Fix ResourceWarning in test_httplib. Patch written by Alex Shkop.Victor Stinner2015-02-271-0/+3
| |
* | Issue #23442: Rename two member names to stay backward compatibleBerker Peksag2015-02-201-0/+61
| | | | | | | | | | | | with the constants in http.client. Initial patch by Demian Brecht.
* | Issue #23439: Add missing entries to http.client.__all__.Berker Peksag2015-02-201-0/+15
|\ \ | |/ | | | | | | | | | | 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.
| * Issue #23439: Add missing entries to http.client.__all__.Berker Peksag2015-02-201-0/+15
| | | | | | | | | | | | | | 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.
* | Issue #13128: Print response headers for CONNECT requests when debuglevel > 0.Berker Peksag2015-02-031-5/+18
| | | | | | | | Patch by Demian Brecht.
* | merge 3.4 (#19996)Benjamin Peterson2015-01-261-0/+10
|\ \ | |/
| * handle headers with no key (closes #19996)Benjamin Peterson2015-01-261-0/+10
| | | | | | | | Patch by Cory Benfield.
* | merge from 3.4Senthil Kumaran2015-01-251-25/+42
|\ \ | |/ | | | | | | | | | | Increase http.client.HTTPConnection test coverage. Added a new tunnel test to verify setting of _tunnel_host, _tunnel_port, _tunnel_headers attributes on HTTPConnection object.
| * Increase http.client.HTTPConnection test coverage.Senthil Kumaran2015-01-251-25/+42
| | | | | | | | | | Added a new tunnel test to verify setting of _tunnel_host, _tunnel_port, _tunnel_headers attributes on HTTPConnection object.
* | http.client: disable Nagle's algorithm (closes #23302)Benjamin Peterson2015-01-231-22/+3
| | | | | | | | Patch by Demian Brecht.
* | merge 3.4Benjamin Peterson2014-12-131-0/+1
|\ \ | |/
| * make sure server threads get cleaned upBenjamin Peterson2014-12-131-0/+1
| |
* | Issue #22095: Fixed HTTPConnection.set_tunnel with default port. The portSerhiy Storchaka2014-12-121-3/+5
|\ \ | |/ | | | | value in the host header was set to "None". Patch by Demian Brecht.
| * Issue #22095: Fixed HTTPConnection.set_tunnel with default port. The portSerhiy Storchaka2014-12-121-3/+5
| | | | | | | | value in the host header was set to "None". Patch by Demian Brecht.
* | merge 3.4 (#22959)Benjamin Peterson2014-12-071-0/+14
|\ \ | |/
| * HTTPSConnection: prefer the context's check_hostname attribute over the ↵Benjamin Peterson2014-12-071-0/+14
| | | | | | | | constructor parameter (#22959)
* | Issue #21032. Fixed socket leak if HTTPConnection.getresponse() fails.Serhiy Storchaka2014-12-011-1/+21
|\ \ | |/ | | | | Original patch by Martin Panter.