Commit Graph

91 Commits

Author SHA1 Message Date
Tim Peters e2c9a6cea7 Suppress new deprecation warnings when running the
test suite.

For urllib2, move the import of gopherlib into the
only function that uses it:  users (including the
test suite) certainly shouldn't see a deprecation
warning just because they import urllib2!  If they
actually use gopher_open(), fine, _then_ they should
see a deprecation warning.
2006-02-18 04:14:16 +00:00
Tim Peters b6be87f9b0 Whitespace normalization. 2006-02-18 03:10:56 +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 531cebad4c Bug #902075: urllib2 now handles "host:port" proxy specifications
Can/should this be backported?
2006-01-21 07:20:56 +00:00
Tim Peters 9e34c04732 Whitespace normalization (via reindent.py). 2005-08-26 15:20:46 +00:00
Georg Brandl e1b13d2019 Bug #735248: Fix urllib2.parse_http_list. 2005-08-24 22:20:32 +00:00
Georg Brandl a5a2088dd7 Bug 1016563: Bug in urllib2 proxy auth 2005-08-24 20:29:32 +00:00
Tim Peters f5f32b4712 Whitespace normalization. 2005-07-17 23:16:17 +00:00
Georg Brandl 5c5fe2f445 RFE [ 1216944 ] Add Error Code Dictionary to urllib2 2005-07-14 06:40:47 +00:00
Georg Brandl 8d457c78b4 bug [ 1175848 ] poorly named variable in urllib2.py 2005-06-26 22:01:35 +00:00
Raymond Hettinger dbecd93b72 Replace list of constants with tuples of constants. 2005-02-06 06:57:08 +00:00
Raymond Hettinger f7bf02ded5 SF patch #1028908
(John J Lee)

Minor code clarification and simplification.
2005-02-05 14:37:06 +00:00
Johannes Gijsbers cdd625a770 Patch #1095362: replace hardcoded test for POST/GET with call to get_method,
removing some duplication and gaining some flexibility in the process.
2005-01-09 05:51:49 +00:00
Jeremy Hylton b300ae3a79 Two small changes, SF bug #974757 and SF patch #1037974.
Pass the full URL to find_user_password(), in particular so that hosts
with port numbers can be looked up.

Also specify the digest algorithm, even if it's MD5.  Titus Brown
verified that this fixes a problem with LiveJournal.
2004-12-22 14:27:19 +00:00
Anthony Baxter 3dd9e46161 Added a usegmt flag to email.Utils.formatdate - this allows it to be
used to replace rfc822.formatdate for protocols like HTTP (where 'GMT' must
be the timezone string).
2004-10-11 13:53:08 +00:00
Andrew M. Kuchling 33ad28b68d Use multi-line import 2004-08-31 11:38:12 +00:00
Tim Peters 9ca3f8551a Whitespace normalization. 2004-08-08 01:05:14 +00:00
Jeremy Hylton 5d9c3031c8 Fix urllib2.urlopen() handling of chunked content encoding.
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.
2004-08-07 17:40:50 +00:00
Martin v. Löwis 65a7975f16 Patch #994595: Recognize Basic auth even if other schemes are offered.
Will backport to 2.3.
2004-08-03 12:59:55 +00:00
Kurt B. Kaiser 3f7cb5d9f5 Patch [ 972332 ] urllib2 FTPHandler bugs / John J. Lee
Modified Files:
	urllib2.py test/test_urllib2.py
2004-07-11 17:14:13 +00:00
Andrew M. Kuchling 85064ffd76 [Patch #988602] Move the urllib2 tests into the test framework 2004-07-10 19:46:40 +00:00
Andrew M. Kuchling f9ea7c067a [Patch #988504] Fix HTTP error handling via a patch from John J. Lee 2004-07-10 15:34:34 +00:00
Andrew M. Kuchling 08c08bb3d1 [Bug #912845] urllib2 only checks for a 200 return code, but 206 is also legal if a Range: header was supplied.
(Actually, should the first 'if' statement be modified to allow any 2xx status code?)
2004-06-29 13:19:19 +00:00
Neal Norwitz 1cdd3632a0 Cleanup: the in operator already returns a bool, no need to bool() it again
Cleanup: use condition to be consistent with code above
CookieJar is in cookielib
2004-06-07 03:49:50 +00:00
Martin v. Löwis 2a6ba9097e Patch #963318: Add support for client-side cookie management. 2004-05-31 18:22:40 +00:00
Mark Hammond c533c986e8 Fix [ 738973 ] urllib2 CacheFTPHandler doesn't work on multiple dirs, as
implemented in patch [ 851736 ].
2004-05-10 07:35:33 +00:00
Martin v. Löwis 8b3e871a19 Patch #944110: Properly process empty passwords. Fixes #944082.
Backported to 2.3.
2004-05-06 01:41:26 +00:00
Andrew M. Kuchling 22ab06e4de Fix comment typo 2004-04-06 19:43:03 +00:00
Jeremy Hylton b3ee6f9921 Fix two bugs in the new do_open() implementation for HTTPHandler.
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.
2004-02-24 19:40:35 +00:00
Martin v. Löwis a79449e7a2 Patch #711838: Allow non-anonymous ftp urls in urllib2.
Backported to 2.3.
2004-02-15 21:19:18 +00:00
Martin v. Löwis 7db04e7c48 Patch #817379: Allow for absolute ftp paths.
Backported to 2.3.
2004-02-15 20:51:39 +00:00
Tim Peters 58eb11cf62 Whitespace normalization. 2004-01-18 20:29:55 +00:00
Jeremy Hylton 023518a6a8 Rewrite AbstractHTTPHandler to use modern httplib interface.
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.
2003-12-17 18:52:16 +00:00
Jeremy Hylton dce391cb39 Remove __del__ methods to avoid creating uncollectable cyclic trash.
Keep close() methods for backwards compatibility.

Does any call close() explicitly?
2003-12-15 16:08:48 +00:00
Jeremy Hylton c1be59f40a SF patch 852995: add processors feature to urllib2
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.
2003-12-14 05:27:34 +00:00
Jeremy Hylton fcefd0d2a5 Apply patch 823328 -- support for rfc 2617 digestion authentication.
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.
2003-10-21 18:07:07 +00:00
Walter Dörwald f0dfc7ac5c Fix a bunch of typos in documentation, docstrings and comments.
(From SF patch #810751)
2003-10-20 14:01:56 +00:00
Jeremy Hylton 0a4a50dd85 SF patch [ 816787 ] urllib2.URLError don't calll IOError.__init__
Not sure if this fix is great, but it's probably a small improvement.
2003-10-06 05:15:13 +00:00
Martin v. Löwis 162f081fb3 Patch 549151, rev4: redirect posts for 301 also. Will backport to 2.2. 2003-07-12 07:33:32 +00:00
Jeremy Hylton aefae5570d Fix wrong header name. The framework looks for auth_header. 2003-07-10 13:30:12 +00:00
Brett Cannon 783eaf4774 Change all header strings to be as if they were capitalize()'ed. Also call
capitalize in AbstractHTTPHandler before inserting headers into HTTP instance.

Closes bug #649742, again.
2003-06-17 21:52:34 +00:00
Tim Peters f545baa0cc Whitespace normalization. 2003-06-15 23:26:30 +00:00
Martin v. Löwis e3b67bcb7e Patch #754340: Fix typo in redirect_request. Will backport to 2.2. 2003-06-14 05:51:25 +00:00
Gustavo Niemeyer 9556fba685 - urllib2.py now knows how to order proxy classes, so the user doesn't
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.
2003-06-07 17:53:08 +00:00
Raymond Hettinger 4ec4fa208e iteritems() should not have been used for self.timeout which changes during the loop. 2003-05-23 08:51:51 +00:00
Brett Cannon df0d87a922 To be on the safe side, backed out any questionable iteritem changes and set back to item calls. 2003-05-18 02:25:07 +00:00
Brett Cannon c8b188a9e2 Revert some changes back to dict.items made in a previous patch. 2003-05-17 19:51:26 +00:00
Brett Cannon 24b2bc3654 Remove assert that checked if a parameter was an instance of Request. Closes patch #639139. 2003-05-12 07:31:53 +00:00
Brett Cannon 86503b131b Change Request.add_header to call string.capitalize in order to normalize
headers and not have any dependency on case.  Closes patch #649742.

Also changed all instances of dict.items to dict.iteritems where appropriate.
2003-05-12 07:29:42 +00:00
Jeremy Hylton 0389295dcd Better fix for newurl as suggested by Jim Jewett in SF bug #730963. 2003-05-05 04:09:13 +00:00