Commit Graph

105 Commits

Author SHA1 Message Date
Neal Norwitz b678ce5aa6 Little cleanup 2006-05-18 06:51:46 +00:00
Georg Brandl 9d6da3e2f2 Delay-import some large modules to speed up urllib2 import.
(fixes #1484793).
2006-05-17 15:17:00 +00:00
Georg Brandl b5f2e5cc50 Patch #1479302: Make urllib2 digest auth and basic auth play together. 2006-05-08 17:36:08 +00:00
Georg Brandl 852bb00818 Patch #1480067: don't redirect HTTP digest auth in urllib2 2006-05-03 05:05:02 +00:00
Georg Brandl bffb0bc064 In stdlib, use hashlib instead of deprecated md5 and sha modules. 2006-04-30 08:57:35 +00:00
Georg Brandl fa42bd7af4 Patch #1470846: fix urllib2 ProxyBasicAuthHandler. 2006-04-30 07:06:11 +00:00
Georg Brandl 7fff58c097 Readd urllib.quote import as it doesn't cause any harm. 2006-04-02 21:13:13 +00:00
Georg Brandl c5ffd91911 Patch #1463012: remove not working undocumented classes from urllib2 2006-04-02 20:48:11 +00:00
Georg Brandl 720096a6bf Patch #1462790: fix urllib2 ProxyHandler for host:port proxies 2006-04-02 20:45:34 +00:00
Georg Brandl 4eb521e595 bug #1462706: guard against host not having FQDN hostname 2006-04-02 20:37:17 +00:00
Georg Brandl 814727582a Update version number to 2.5 2006-03-31 20:02:40 +00:00
Georg Brandl 80bb2bb7eb Revert r43399. 2006-03-28 19:19:56 +00:00
Georg Brandl f1349cd05d Bug #1459963: urllib2 now normalizes HTTP header names correctly
with title().
2006-03-28 12:40:24 +00:00
Georg Brandl ddb84d7c69 Bug #1353433: be conciliant with spaces in redirect URLs 2006-03-18 11:35:18 +00:00
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