summaryrefslogtreecommitdiffstats
path: root/Lib/httplib.py
Commit message (Collapse)AuthorAgeFilesLines
* Implement IDNA (Internationalized Domain Names in Applications).Martin v. Löwis2003-04-181-3/+3
|
* Reverted the previous change to read() and readline().Raymond Hettinger2003-03-061-18/+28
| | | | | | Kevin Jacobs found that the code simplification did not exactly match the semantics of the original. Regression test cases were requested.
* Module review:Raymond Hettinger2003-02-261-40/+30
| | | | | | | * Replaced "while 1" with "while True" * Rewrote read() and readline() for clarity and speed. * Replaced variable 'list' with 'hlist' * Used augmented assignment in two places.
* typoSkip Montanaro2003-02-251-1/+1
|
* Whitespace normalization.Tim Peters2002-11-241-1/+1
|
* Remove some test code.Jeremy Hylton2002-11-131-33/+0
| | | | | The buggy yahoo server was fixed, and the opalgroup test files are gone.
* Fix SF bug #637789: Handle Proxy-Connection header.Jeremy Hylton2002-11-131-15/+25
| | | | Also, remove unused local variable noted by pychecker.
* Whitespace normalization.Tim Peters2002-11-091-2/+2
|
* Move code for reading chunked responses in helper function,Jeremy Hylton2002-09-031-45/+52
| | | | along with some small changes (e.g. use of +=).
* SF bug [ 600488 ] Robustness tweak to httplib.pyJeremy Hylton2002-09-031-3/+1
| | | | | If the transfer-encoding is unknown, ignore it. Suggested by Tom Emerson.
* Whitespace normalization.Tim Peters2002-08-081-1/+1
|
* typoSkip Montanaro2002-07-251-1/+1
|
* Fix typos and such caught by the pycheckerbot.Jeremy Hylton2002-07-161-3/+3
|
* Whitespace normalization.Tim Peters2002-07-161-6/+6
|
* Send HTTP requests with a single send() call instead of many.Jeremy Hylton2002-07-161-15/+26
| | | | | | | | | | | | | | | | | | | | | | The implementation now stores all the lines of the request in a buffer and makes a single send() call when the request is finished, specifically when endheaders() is called. This appears to improve performance. The old code called send() for each line. The sends are all short, so they caused bad interactions with the Nagle algorithm and delayed acknowledgements. In simple tests, the second packet was delayed by 100s of ms. The second send was delayed by the Nagle algorithm, waiting for the ack. The delayed ack strategy delays the ack in hopes of piggybacking it on a data packet, but the server won't send any data until it receives the complete request. This change minimizes the problem that Nagle + delayed ack will cause a problem, although a request large enough to be broken into two packets will still suffer some delay. Luckily the MSS is large enough to accomodate most single packets. XXX Bug fix candidate?
* Change _begin() back to begin().Jeremy Hylton2002-07-121-3/+2
| | | | Client code could create responses explicitly.
* Fix for SF bug 579107.Jeremy Hylton2002-07-091-36/+88
| | | | | | | | | | The recent SSL changes resulted in important, but subtle changes to close() semantics. Since builtin socket makefile() is not called for SSL connections, we don't get separately closeable fds for connection and response. Comments in the code explain how to restore makefile semantics. Bug fix candidate.
* Fix for SF bug #432621: httplib: multiple Set-Cookie headersJeremy Hylton2002-07-071-2/+108
| | | | | | | | | | If multiple header fields with the same name occur, they are combined according to the rules in RFC 2616 sec 4.2: Appending each subsequent field-value to the first, each separated by a comma. The order in which header fields with the same field-name are received is significant to the interpretation of the combined field value.
* Fix SF bug #575360Jeremy Hylton2002-07-061-0/+6
| | | | | | | Subclasses of Exception that define an __init__ must call Exception.__init__ or define self.args. Otherwise, str() will fail. Bug fix candidate.
* Handle HTTP/0.9 responses.Jeremy Hylton2002-07-061-19/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Section 19.6 of RFC 2616 (HTTP/1.1): It is beyond the scope of a protocol specification to mandate compliance with previous versions. HTTP/1.1 was deliberately designed, however, to make supporting previous versions easy.... And we would expect HTTP/1.1 clients to: - recognize the format of the Status-Line for HTTP/1.0 and 1.1 responses; - understand any valid response in the format of HTTP/0.9, 1.0, or 1.1. The changes to the code do handle response in the format of HTTP/0.9. Some users may consider this a bug because all responses with a sufficiently corrupted status line will look like an HTTP/0.9 response. These users can pass strict=1 to the HTTP constructors to get a BadStatusLine exception instead. While this is a new feature of sorts, it enhances the robustness of the code (be tolerant in what you accept). Thus, I consider it a bug fix candidate. XXX strict needs to be documented.
* Convert raise to call exception class. Add whitespace.Jeremy Hylton2002-07-021-1/+1
|
* Simplify HTTPSConnection constructor.Jeremy Hylton2002-06-281-21/+7
| | | | See discussion in SF bug 458463.
* Fixes for two separate HTTP/1.1 bugs: 100 responses and HTTPS connections.Jeremy Hylton2002-06-281-32/+102
| | | | | | | | | | | | | | | | | | | | | | | The HTTPResponse class now handles 100 continue responses, instead of choking on them. It detects them internally in the _begin() method and ignores them. Based on a patch by Bob Kline. This closes SF bugs 498149 and 551273. The FakeSocket class (for SSL) is now usable with HTTP/1.1 connections. The old version of the code could not work with persistent connections, because the makefile() implementation read until EOF before returning. If the connection is persistent, the server sends a response and leaves the connection open. A client that reads until EOF will block until the server gives up on the connection -- more than a minute in my test case. The problem was fixed by implementing a reasonable makefile(). It reads data only when it is needed by the layers above it. It's implementation uses an internal buffer with a default size of 8192. Also, rename begin() method of HTTPResponse to _begin() because it should only be called by the HTTPConnection.
* SF 563203. Replaced 'has_key()' with 'in'.Raymond Hettinger2002-06-011-1/+1
|
* Forward port of patch # 500311: Work around for buggy https servers.Martin v. Löwis2002-04-201-1/+2
| | | | Fixes #494762.
* oops - export InvalidURL in __all__Skip Montanaro2002-03-241-1/+1
|
* add InvalidURL exception - raised if port is given but empty or non-numericSkip Montanaro2002-03-241-1/+7
|
* [Bug #531616] Make HTTPS work again by adding a sendall method to theAndrew M. Kuchling2002-03-181-0/+3
| | | | | | | | | | FakeSocket class. Without it, the sendall() call got the method on the underlying socket object, and that messed up SSL. Does httplib use other methods of sockets that FakeSocket doesn't support? Someone should take a look... (I'll try to give it a once-over.) 2.2.1 bugfix candidate.
* Fix SF bug 525520.Jeremy Hylton2002-03-091-20/+34
| | | | | Don't automatically add a Host: header if the headers passed to request() already has a Host key.
* SF bug report #405939: wrong Host header with proxyJeremy Hylton2002-03-081-3/+21
| | | | | | | | | | | | | | | In August, Greg said this looked good, so I'm going ahead with it. The fix is different from the one in the bug report. Instead of using a regular expression to extract the host from the url, I use urlparse.urlsplit. Martin commented that the patch doesn't address URLs that have basic authentication username and password in the header. I don't see any code anywhere in httplib that supports this feature, so I'm not going to address it for this fix. Bug fix candidate.
* The Grande 'sendall()' patch, copied from release21-maint. Fixes #516715.Martin v. Löwis2002-02-161-1/+1
| | | | | Replaces calls to socket.send() (which isn't guaranteed to send all data) with the new socket.sendall() method.
* SF #515011, cleanup: remove "or 0" conditionNeal Norwitz2002-02-111-2/+1
|
* Somebody checked in a version of httplib that doesn't even compile --Tim Peters2001-10-111-1/+1
| | | | SyntaxError. Fix it.
* Fix for SF buf #458835Jeremy Hylton2001-10-111-3/+14
| | | | | | | | | | | | | | | | | Try to be systematic about dealing with socket and ssl exceptions in FakeSocket.makefile(). The previous version of the code caught all ssl errors and treated them as EOF, even though most of the errors don't mean EOF. An SSL error can mean on of three things: 1. The SSL/TLS connection was closed. 2. The operation should be retried. 3. An error occurred. Also, if a socket error occurred and the error was EINTR, retry the call. Otherwise, it was a legitimate error and the caller should receive the exception.
* Only close sockets if they have been created. Reported by Blake Winton.Martin v. Löwis2001-10-071-1/+2
|
* Resolve patch #449367.Greg Stein2001-08-181-15/+26
| | | | | | | | | | | For the HTTPS class (when available), ensure that the x509 certificate data gets passed through to the HTTPSConnection class. Create a new HTTPS.__init__ to do this, and refactor the HTTP.__init__ into a new _setup method for both init's to call. Note: this is solved differently from the patch, which advocated a new **x509 parameter on the base HTTPConnection class. But that would open HTTPConnection to arbitrary (ignored) parameters, so was not as desirable.
* Initialize msg to avoid unbound locals.Martin v. Löwis2001-07-311-0/+1
|
* Untabify IPv6 changes.Martin v. Löwis2001-07-261-16/+16
|
* Patch #401196: Use getaddrinfo and AF_INET6 in TCP servers and clients.Martin v. Löwis2001-07-241-4/+16
|
* more public symbols for __all__Skip Montanaro2001-06-011-1/+6
|
* SF patch #405845 by Martin von LöwisJeremy Hylton2001-04-131-1/+7
| | | | | | Fixes SF bug #405427. If an http response has a bogus return code, e.g. 400.100, raise BadStatusLine.
* An ssl-wrapped socket now returns '' on EOF, just like a regularJeremy Hylton2001-02-011-3/+7
| | | | | | socket -- as suggested by Clarence Gardner. Fix httplib to comply with the new ssl-socket interface.
* added a few more __all__ listsSkip Montanaro2001-01-231-0/+2
| | | | fixed typo in ihooks docstring
* Revert a change I accidentally checked in together with Ping'sGuido van Rossum2001-01-151-4/+1
| | | | "smallest patch ever".
* Whitespace normalization.Tim Peters2001-01-141-17/+17
|
* SF Patch #103232 by dougfort: Preserve Nonstandard Port Number in HostGuido van Rossum2001-01-141-1/+6
| | | | | | | | | | Header Dougfort's comments: httplib does not include ':port ' in the HTTP 1.1 'Host:' header. This causes problems if the server is not listening on Port 80. The test case I use is the login to /manage under Zope, with Zope listening on port 8080. Zope returns a <frameset> with the <frame> source URLs lacking the :8080.
* No text file relying on significant trailing whitespace is robust underTim Peters2001-01-131-16/+16
| | | | modification. Removed the need for that.
* SF Patch #103225 by Ping: httplib: smallest Python patch everGuido van Rossum2001-01-131-2/+5
| | | | | | | The ASCII-art diagram at the top of httplib contains a backslash at the end of a line, which causes Python to remove the newline. This one-character patch adds a space after the backslash so it will appear at the end of the line in the docstring as intended.
* Get rid of string functions.Guido van Rossum2000-12-151-14/+12
| | | | | There should really be a little tool to help with this -- it's rather tedious and there are lots of special cases!
* Hoepeful fix for SF bug #123924: Windows - using OpenSSL, problem withGuido van Rossum2000-12-111-1/+4
| | | | | | | | | | | | | | | | socket in httplib.py. The bug reports that on Windows, you must pass sock._sock to the socket.ssl() call. But on Unix, you must pass sock itself. (sock is a wrapper on Windows but not on Unix; the ssl() call wants the real socket object, not the wrapper.) So we see if sock has an _sock attribute and if so, extract it. Unfortunately, the submitter of the bug didn't confirm that this patch works, so I'll just have to believe it (can't test it myself since I don't have OpenSSL on Windows set up, and that's a nontrivial thing I believe).