New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
urllib doesn't correct server returned urls #40042
Comments
On a URL request where the server returns a URL with spaces in, I think this is technically a server error, however, it does work I would suggest that when urllib is following "moved temporarily" See example program file for more including detailed server/client |
Logged In: YES I've tested a change to "redirect_internal(self, url, fp, errcode, errmsg, This information is placed in the public domain. |
Logged In: YES I agree that it is a server error to put something that doesn't As for your proposed fix, instead of just correcting spaces, I newurl = quote(newurl, safe="/:=&?#+!$,;'@()*[]") quote() is a urllib function that does percent-encoding. It is I am currently working on a urllib.quote() replacement for |
Logged In: YES In my previous example, I forgot to add a tilde to the "safe" newurl = quote(newurl, safe="/:=&?~#+!$,;'@()*[]") |
Superseded by bpo-1153027 ? |
I agree - this appears to be the same as bpo-1153027 ? |
This bug refers to urllib. bpo-1153027 refers to urllib2. It's the |
Any idea about how to test this one reliably? |
Mike's list is missing one more character, "%" itself. So, the quote(newurl, safe="%/:=&?~#+!$,;'@()*[]") The replacement should be done in the .open() method, not in the code |
A suitable test would be to derive a urllib.URLOpener subclass that has |
Uh, that should have beeen something like |
The attached patch fixes this issue and adds the test too. Followed John For the other referenced bpo-1153027, bug is not reproducible in the |
Fixed this in the revision 71780 for Python 2.7. |
This seems a bit serious for inclusion in 2.7 IMHO. urllib is used in all |
AdamN, did you specifically come across a scenario which broke due to |
I can't think of too many specific scenarios. It just seems like a non- One issue I see is that the ticket morphed from just dealing with space The other issue I'm concerned about is that there is no testing of non- Finally, a netloc like 'www.g oogle.com' would be converted invalidly to I can't point to anything too specific - more of just a feeling that |
This change was a fix for bpo-1353433: commit ddb84d7
|
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: