summaryrefslogtreecommitdiffstats
path: root/Lib/urllib2.py
Commit message (Collapse)AuthorAgeFilesLines
* Whitespace normalization.Tim Peters2004-08-081-3/+3
|
* Fix urllib2.urlopen() handling of chunked content encoding.Jeremy Hylton2004-08-071-2/+14
| | | | | | | | | | | | | | | | | The change to use the newer httplib interface admitted the possibility that we'd get an HTTP/1.1 chunked response, but the code didn't handle it correctly. The raw socket object can't be pass to addinfourl(), because it would read the undecoded response. Instead, addinfourl() must call HTTPResponse.read(), which will handle the decoding. One extra wrinkle is that the HTTPReponse object can't be passed to addinfourl() either, because it doesn't implement readline() or readlines(). As a quick hack, use socket._fileobject(), which implements those methods on top of a read buffer. (suggested by mwh) Finally, add some tests based on test_urllibnet. Thanks to Andrew Sawyers for originally reporting the chunked problem.
* Patch #994595: Recognize Basic auth even if other schemes are offered.Martin v. Löwis2004-08-031-1/+1
| | | | Will backport to 2.3.
* Patch [ 972332 ] urllib2 FTPHandler bugs / John J. LeeKurt B. Kaiser2004-07-111-2/+4
| | | | | Modified Files: urllib2.py test/test_urllib2.py
* [Patch #988602] Move the urllib2 tests into the test frameworkAndrew M. Kuchling2004-07-101-77/+0
|
* [Patch #988504] Fix HTTP error handling via a patch from John J. LeeAndrew M. Kuchling2004-07-101-10/+6
|
* [Bug #912845] urllib2 only checks for a 200 return code, but 206 is also ↵Andrew M. Kuchling2004-06-291-2/+2
| | | | | | legal if a Range: header was supplied. (Actually, should the first 'if' statement be modified to allow any 2xx status code?)
* Cleanup: the in operator already returns a bool, no need to bool() it againNeal Norwitz2004-06-071-4/+4
| | | | | Cleanup: use condition to be consistent with code above CookieJar is in cookielib
* Patch #963318: Add support for client-side cookie management.Martin v. Löwis2004-05-311-16/+59
|
* Fix [ 738973 ] urllib2 CacheFTPHandler doesn't work on multiple dirs, asMark Hammond2004-05-101-1/+1
| | | | implemented in patch [ 851736 ].
* Patch #944110: Properly process empty passwords. Fixes #944082.Martin v. Löwis2004-05-061-1/+1
| | | | Backported to 2.3.
* Fix comment typoAndrew M. Kuchling2004-04-061-1/+1
|
* Fix two bugs in the new do_open() implementation for HTTPHandler.Jeremy Hylton2004-02-241-6/+17
| | | | | | | | | Invoke the standard error handlers for non-200 responses. Always supply a "Connection: close" header to prevent the server from leaving the connection open. Downstream users of the socket may attempt recv()/read() with no arguments, which would block if the connection were kept open.
* Patch #711838: Allow non-anonymous ftp urls in urllib2.Martin v. Löwis2004-02-151-6/+15
| | | | Backported to 2.3.
* Patch #817379: Allow for absolute ftp paths.Martin v. Löwis2004-02-151-1/+1
| | | | Backported to 2.3.
* Whitespace normalization.Tim Peters2004-01-181-7/+7
|
* Rewrite AbstractHTTPHandler to use modern httplib interface.Jeremy Hylton2003-12-171-25/+26
| | | | | | | | | | | | The chief benefit of this change is that requests will now use HTTP/1.1 instead of HTTP/1.0. Bump the module version number as part of the change. There are two possible incompatibilities that we'll need to watch out for when we get to an alpha release. We may get a different class of exceptions out of httplib, and the do_open() method changed its signature. The latter is only important if anyone actually subclasses AbstractHTTPHandler.
* Remove __del__ methods to avoid creating uncollectable cyclic trash.Jeremy Hylton2003-12-151-13/+4
| | | | | | Keep close() methods for backwards compatibility. Does any call close() explicitly?
* SF patch 852995: add processors feature to urllib2Jeremy Hylton2003-12-141-56/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | John J. Lee writes: "the patch makes it possible to implement functionality like HTTP cookie handling, Refresh handling, etc. etc. using handler objects. At the moment urllib2's handler objects aren't quite up to the job, which results in a lot of cut-n-paste and subclassing. I believe the changes are backwards-compatible, with the exception of people who've reimplemented build_opener()'s functionality -- those people would need to call opener.add_handler(HTTPErrorProcessor). The main change is allowing handlers to implement methods like: http_request(request) http_response(request, response) In addition to the usual http_open(request) http_error{_*}(...) " Note that the change isn't well documented at least in part because handlers aren't well documented at all. Need to fix this. Add a bunch of new tests. It appears that none of these tests actually use the network, so they don't need to be guarded by a resource flag.
* Apply patch 823328 -- support for rfc 2617 digestion authentication.Jeremy Hylton2003-10-211-44/+96
| | | | | | | | | | | | The patch was tweaked slightly. It's get a different mechanism for generating the cnonce which uses /dev/urandom when possible to generate less-easily-guessed random input. Also rearrange the imports so that they are alphabetical and duplicates are eliminated. Add a few XXX comments about things left undone and things that could be improved.
* Fix a bunch of typos in documentation, docstrings and comments.Walter Dörwald2003-10-201-1/+1
| | | | (From SF patch #810751)
* SF patch [ 816787 ] urllib2.URLError don't calll IOError.__init__Jeremy Hylton2003-10-061-1/+5
| | | | Not sure if this fix is great, but it's probably a small improvement.
* Patch 549151, rev4: redirect posts for 301 also. Will backport to 2.2.Martin v. Löwis2003-07-121-5/+5
|
* Fix wrong header name. The framework looks for auth_header.Jeremy Hylton2003-07-101-8/+10
|
* Change all header strings to be as if they were capitalize()'ed. Also callBrett Cannon2003-06-171-9/+9
| | | | | | capitalize in AbstractHTTPHandler before inserting headers into HTTP instance. Closes bug #649742, again.
* Whitespace normalization.Tim Peters2003-06-151-1/+1
|
* Patch #754340: Fix typo in redirect_request. Will backport to 2.2.Martin v. Löwis2003-06-141-1/+1
|
* - urllib2.py now knows how to order proxy classes, so the user doesn'tGustavo Niemeyer2003-06-071-11/+24
| | | | | | have to insert it in front of other classes, nor do dirty tricks like inserting a "dummy" HTTPHandler after a ProxyHandler when building an opener with proxy support.
* iteritems() should not have been used for self.timeout which changes during ↵Raymond Hettinger2003-05-231-1/+1
| | | | the loop.
* To be on the safe side, backed out any questionable iteritem changes and set ↵Brett Cannon2003-05-181-2/+2
| | | | back to item calls.
* Revert some changes back to dict.items made in a previous patch.Brett Cannon2003-05-171-2/+2
|
* Remove assert that checked if a parameter was an instance of Request. ↵Brett Cannon2003-05-121-1/+0
| | | | Closes patch #639139.
* Change Request.add_header to call string.capitalize in order to normalizeBrett Cannon2003-05-121-7/+8
| | | | | | headers and not have any dependency on case. Closes patch #649742. Also changed all instances of dict.items to dict.iteritems where appropriate.
* Better fix for newurl as suggested by Jim Jewett in SF bug #730963.Jeremy Hylton2003-05-051-12/+2
|
* Add comment explaining try/except for endheaders().Jeremy Hylton2003-05-051-0/+2
|
* Repair redirect handling and raise URLError on host-not-found.Jeremy Hylton2003-05-041-22/+36
| | | | | | | | | | | | | | The latest changes to the redirect handler couldn't possibly have been tested, because they did not compute a newurl and failed with a NameError. The __name__ == "__main__": block has a test for redirects. Also, fix SF bug 723831. A urlopen() that failed because the host was not found raised a socket.gaierror unlike earlier versions of urllib2. The problem is that httplib actually establishes the connection at a different point starting with Python 2.2. Move the try/except to endheaders(), which is where the connection gets established.
* SF Patch 549151: urllib2 POSTs on redirectRaymond Hettinger2003-04-241-4/+34
| | | | (contributed by John J Lee)
* Fix NameError exception ('name' undefined)Andrew M. Kuchling2002-11-061-0/+1
|
* Typo in docstringJeremy Hylton2002-10-111-1/+1
|
* Fix for SF bug #599836: Don't duplicate headers.Jeremy Hylton2002-10-111-2/+3
| | | | | If the request object has a header, it should override the default header provided by the OpenerDirector.
* SF #614596, fix for urllib2.AbstractBasicAuthHandler, John Williams (johnw42)Neal Norwitz2002-10-091-1/+1
| | | | Make the regex case insensitive for some web sites which use Realm.
* Remove ugly irregular spaces from in front of some comments.Fred Drake2002-08-131-3/+3
|
* Whitespace normalization.Tim Peters2002-07-161-2/+2
|
* Fix from SF patch #527518: proxy config with user+pass authentication.Jeremy Hylton2002-07-071-3/+8
| | | | Bug fix candidate.
* Fix HTTPError __init__ for cases where fp is None.Jeremy Hylton2002-06-031-2/+6
| | | | | | | | | | | | | | | | | | | | | The HTTPError class tries to act as a regular response objects for HTTP protocol errors that include full responses. If the failure is more basic, like no valid response, the __init__ choked when it tried to initialize its superclasses in addinfourl hierarchy that requires a valid response. The solution isn't elegant but seems to be effective. Do not initialize the base classes if there isn't a file object containing the response. In this case, user code expecting to use the addinfourl methods will fail; but it was going to fail anyway. It might be cleaner to factor out HTTPError into two classes, only one of which inherits from addinfourl. Not sure that the extra complexity would lead to any improved functionality, though. Partial fix for SF bug # 563665. Bug fix candidate for 2.1 and 2.2.
* Remove uses of the string and types modules:Walter Dörwald2002-06-031-4/+3
| | | | | | | | | | | | | | | | | | | | | | x in string.whitespace => x.isspace() type(x) in types.StringTypes => isinstance(x, basestring) isinstance(x, types.StringTypes) => isinstance(x, basestring) type(x) is types.StringType => isinstance(x, str) type(x) == types.StringType => isinstance(x, str) string.split(x, ...) => x.split(...) string.join(x, y) => y.join(x) string.zfill(x, ...) => x.zfill(...) string.count(x, ...) => x.count(...) hasattr(types, "UnicodeType") => try: unicode except NameError: type(x) != types.TupleTuple => not isinstance(x, tuple) isinstance(x, types.TupleType) => isinstance(x, tuple) type(x) is types.IntType => isinstance(x, int) Do not mention the string module in the rlcompleter docstring. This partially applies SF patch http://www.python.org/sf/562373 (with basestring instead of string). (It excludes the changes to unittest.py and does not change the os.stat stuff.)
* SF 563203. Replaced 'has_key()' with 'in'.Raymond Hettinger2002-06-011-10/+10
|
* Use types.StringTypes instead of (types.StringType, types.UnicodeType) --Michael W. Hudson2002-05-201-2/+2
| | | | | | works better (at all!) in --disable-unicode builds. Bugfix candidate, probably.
* Partial introduction of bools where appropriate.Guido van Rossum2002-04-071-4/+4
|
* Patch #525870: Avoid duplicate stat calls, use st_ attributes.Martin v. Löwis2002-03-181-4/+2
|