Commit Graph

107 Commits

Author SHA1 Message Date
Martin v. Löwis f25e35b9ec Bug #978833: Close https sockets by releasing the _ssl object. 2007-07-27 18:28:22 +00:00
Facundo Batista 70f996be24 Added timeout support to HTTPSConnection, through the
socket.create_connection function. Also added a small
test for this, and updated NEWS file.
2007-05-21 17:32:32 +00:00
Georg Brandl f03facfe90 Some nits. 2007-03-26 20:28:28 +00:00
Facundo Batista 07c78be0b4 Added a 'create_connect()' function to socket.py, which creates a
connection with an optional timeout, and modified httplib.py to
use this function in HTTPConnection. Applies patch 1676823.
2007-03-23 18:54:07 +00:00
Martin v. Löwis 0af338859b Bug #978833: Revert r50844, as it broke _socketobject.dup.
Will backport.
2007-03-23 13:27:15 +00:00
Tim Peters f733abb783 Whitespace normalization. 2007-01-30 03:03:46 +00:00
Martin v. Löwis 040a927cd1 Patch #1065257: Support passing open files as body in
HTTPConnection.request().
2006-11-12 10:32:47 +00:00
Andrew M. Kuchling ca2e79000b Minor typo fixes 2006-07-30 00:27:34 +00:00
Martin v. Löwis 9298eff5f9 Bug #978833: Really close underlying socket in _socketobject.close.
Fix httplib.HTTPConnection.getresponse to not close the
socket if it is still needed for the response.
2006-07-26 12:12:56 +00:00
Georg Brandl a2ac2ef44f RFE #1472176: In httplib, don't encode the netloc and hostname with "idna" if not necessary. 2006-05-03 18:03:22 +00:00
Georg Brandl 6aab16e9f6 Move "httpresponses" dict from urllib2 to httplib where it belongs. 2006-02-17 19:17:25 +00:00
Georg Brandl 80ba8e8549 bug [ 1296004 ] MemoryError in httplib 2005-09-29 20:16:07 +00:00
Georg Brandl 0aade9a9f9 bug [ 1155638 ] self.length shield exception in httplib 2005-06-26 22:06:54 +00:00
Jeremy Hylton def9d2a17c Fix for SF bug 988120 via patch 1061941.
If read() returned less than the number of bytes request, the full amount was subtracted from length instead of the actually read amount.
2004-11-07 16:13:49 +00:00
Raymond Hettinger 4d03791632 SF bug #1046855: httplib index out of range 2004-10-14 15:23:38 +00:00
Martin v. Löwis 39a317890f Patch #1025790: Add status code constants to httplib. 2004-09-18 09:03:49 +00:00
Brett Cannon 0a1af4aeb0 Remove tabs. 2004-09-15 23:26:23 +00:00
Martin v. Löwis 74a249e1a9 Strip square brackets from IPv6 address. 2004-09-14 21:45:36 +00:00
Skip Montanaro cae14d2714 missed the obvious test case and corresponding fix 2004-09-14 17:55:21 +00:00
Skip Montanaro 10e6e0e61a Search from the end of the host/port combination to find the colon which
separates ip address from the port to accommodate ipv6 addresses.
2004-09-14 16:32:02 +00:00
Martin v. Löwis deacce2c87 Patch #800236: add HTTPResponse.getheaders(). 2004-08-18 12:46:26 +00:00
Jeremy Hylton 2c178253bd SF bug 874842 and patch 997626: httplib bugs
Hack httplib to work with broken Akamai proxies.
Make sure that httplib doesn't add extract Accept-Encoding or
Content-Length headers if the client has already set them.
2004-08-07 16:28:14 +00:00
Hye-Shik Chang 39aef79821 Fix a bug that robotparser starves memory when the server responses
in HTTP/0.9 due to dissonance of httplib.LineAndFileWrapper and
urllib.addbase.
2004-06-05 13:30:56 +00:00
Raymond Hettinger bac788a3cd Replace str.find()!=1 with the more readable "in" operator. 2004-05-04 09:21:43 +00:00
Tim Peters 58eb11cf62 Whitespace normalization. 2004-01-18 20:29:55 +00:00
Martin v. Löwis af7dc8d8b8 Patch #831747: Add skip_accept_encoding parameter to putrequest. 2003-11-19 19:51:55 +00:00
Alex Martelli 0c5b4ad8f2 fixed obvious bug in _send_header as per SF bug #831271
(same as commit of Sun Nov 2 to the release23-maint branch)
2003-11-09 16:41:38 +00:00
Martin v. Löwis 11892ecd6d Patch #817854: Add missing operations for SSLFile. Fixes #792101.
Backported to 2.3.
2003-10-27 14:07:53 +00:00
Jeremy Hylton b67695238d Fix sf bug 666219: assertion error in httplib.
The obvious way for this assertion to fail is if the LineAndFileWrapper constructor is called when an empty line.  Raise a BadStatusError before the call.
2003-06-29 17:55:05 +00:00
Greg Stein 616a58d79a Deal with a couple XXX comments which asked questions.
In response to "shouldn't the client close the file?", the answer is
"no". The original design behind HTTPConnection is that the client did
not have to worry about it. The response would close itself when you
read the last of the data from it. This closing also dealt with
allowing the connection to perform another request/response (if it was
a persistent connection).

However... the auto-close behavior broke compatibility with the
classic httplib.HTTP class' behavior when a zero-length response body
was present. In that situation, the HTTPResponse object was
auto-closing it since there was no data present, and for an HTTP/1.0
connection-close socket (or an HTTP/0.9 request) connection, that also
ended up closing the socket. When an httplib.HTTP user went to read
the socket... boom. A patch to correct the auto-close (for compat with
old httplib users) was added in rev 1.22.

But for non-zero-length *chunked* bodies, we should keep the
auto-close behavior. The library user is not reading the socket (they
can't cuz of the chunked response we just got done handling), so they
should be immune to the response closing the socket. In fact, I would
like to see (one day) the auto-close restored, and the HTTP subclass
would simply have a flag to disable that behavior (for back-compat
purposes).
2003-06-24 06:35:19 +00:00
Martin v. Löwis 1867f24416 Always unwrap _socketobj in socket.ssl. Revert httplib.py 1.25.
Fixes #754447.
2003-06-14 13:30:53 +00:00
Tim Peters c2659cff5d Whitespace normalization. 2003-05-12 20:19:37 +00:00
Jeremy Hylton c1b2cb9d8f SF bug 622042: Don't expect response body from HEAD request.
Bug fix candidate.
2003-05-05 16:13:58 +00:00
Martin v. Löwis 2548c730c1 Implement IDNA (Internationalized Domain Names in Applications). 2003-04-18 10:39:54 +00:00
Raymond Hettinger 4922768d02 Reverted the previous change to read() and readline().
Kevin Jacobs found that the code simplification did not
exactly match the semantics of the original.  Regression
test cases were requested.
2003-03-06 16:31:48 +00:00
Raymond Hettinger b2e0b92ef1 Module review:
* 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.
2003-02-26 22:45:18 +00:00
Skip Montanaro 74b9a7a71f typo 2003-02-25 17:48:15 +00:00
Tim Peters 77c06fbf94 Whitespace normalization. 2002-11-24 02:35:35 +00:00
Jeremy Hylton 77628658ca Remove some test code.
The buggy yahoo server was fixed, and the opalgroup test files are
gone.
2002-11-13 17:30:32 +00:00
Jeremy Hylton 22b3a49d3c Fix SF bug #637789: Handle Proxy-Connection header.
Also, remove unused local variable noted by pychecker.
2002-11-13 17:27:43 +00:00
Tim Peters 230a60c6ec Whitespace normalization. 2002-11-09 05:08:07 +00:00
Jeremy Hylton d4c472c3e2 Move code for reading chunked responses in helper function,
along with some small changes (e.g. use of +=).
2002-09-03 20:49:06 +00:00
Jeremy Hylton d229b3ae04 SF bug [ 600488 ] Robustness tweak to httplib.py
If the transfer-encoding is unknown, ignore it.  Suggested by Tom
Emerson.
2002-09-03 19:24:24 +00:00
Tim Peters 469cdad822 Whitespace normalization. 2002-08-08 20:19:19 +00:00
Skip Montanaro 186bec2f8d typo 2002-07-25 16:10:38 +00:00
Jeremy Hylton e3252ec6cf Fix typos and such caught by the pycheckerbot. 2002-07-16 21:41:43 +00:00
Tim Peters c411dbaeee Whitespace normalization. 2002-07-16 21:35:23 +00:00
Jeremy Hylton 8531b1b28d Send HTTP requests with a single send() call instead of many.
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?
2002-07-16 21:21:11 +00:00
Jeremy Hylton 39c03808c7 Change _begin() back to begin().
Client code could create responses explicitly.
2002-07-12 14:04:09 +00:00
Jeremy Hylton 29d27ac4fe Fix for SF bug 579107.
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.
2002-07-09 21:22:36 +00:00