msg56009 - (view) |
Author: Jim Jewett (jimjjewett) |
Date: 2007-09-18 20:22 |
Under the http protocol, any 2xx response is OK. urllib.py and urllib2.py hardcoded only response 200 (the most common). http://bugs.python.org/issue912845 added 206 as acceptable to urllib2, but not any other 20x responses. (It also didn't fix urllib.) Suggested for 2.6, as it does change behavior. (Also see duplicate http://bugs.python.org/issue971965 which I will try to close after opening this. ) |
|
|
msg56011 - (view) |
Author: Facundo Batista (facundobatista) *  |
Date: 2007-09-18 20:43 |
It should behave as you say, yes. I fixed the class HTTPErrorProcessor(BaseHandler) regarding this issue, to not raise an error if response is 2xx (see rev 54927). Regards, |
|
|
msg56014 - (view) |
Author: Sean Reifschneider (jafo) *  |
Date: 2007-09-18 21:18 |
Facundo: Should this be closed? |
|
|
msg56016 - (view) |
Author: Jim Jewett (jimjjewett) |
Date: 2007-09-18 21:30 |
Jafo: His fix is great for urllib2, but the same issue applies to the original urllib. The ticket should not be closed until a similar fix is made to lines 330 and 417 of urllib.py. That is, change "if errcode == 200:" to "if 200 <= errcode < 300:" (Or, if rejecting the change, add a comment saying that it is left that way intentionally for backwards compatibility.) -jJ |
|
|
msg56030 - (view) |
Author: Sean Reifschneider (jafo) *  |
Date: 2007-09-19 07:55 |
Ported code change to urllib, passes tests, committed as revision 58206 |
|
|
msg56031 - (view) |
Author: Georg Brandl (georg.brandl) *  |
Date: 2007-09-19 08:06 |
This might need at least a NEWS entry, if not a documentation clarification. |
|
|
msg56033 - (view) |
Author: Sean Reifschneider (jafo) *  |
Date: 2007-09-19 08:19 |
Facundo, can you do a NEWS update on this? |
|
|
msg56037 - (view) |
Author: Facundo Batista (facundobatista) *  |
Date: 2007-09-19 14:05 |
Done, rev 58207. |
|
|
msg56113 - (view) |
Author: Jim Jewett (jimjjewett) |
Date: 2007-09-24 14:50 |
The change still missed the httpS copy. I'm attaching a minimal change. I think it might be better to just combine the methods -- as was already done in Py3K. Unfortunately, the py3K code doesn't run cleanly in 2.5, and I haven't yet had a chance to test a backported equivalent. (Hopefully tonight.) |
|
|
msg56121 - (view) |
Author: Georg Brandl (georg.brandl) *  |
Date: 2007-09-24 18:08 |
Applied your patch as r58247. |
|
|
msg59086 - (view) |
Author: Kurt B. Kaiser (kbk) *  |
Date: 2008-01-02 04:11 |
r58207 and r58247 patch logic is reversed. |
|
|
msg59087 - (view) |
Author: Kurt B. Kaiser (kbk) *  |
Date: 2008-01-02 04:13 |
Reversed the logic of the previous patches to urllib.py and added a test case. I noticed the problem when I tried to retrieve a file which required auth. r59661 |
|
|