Skip to content
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

fix #2247 #2249

Merged
merged 2 commits into from Oct 5, 2014
Merged

fix #2247 #2249

merged 2 commits into from Oct 5, 2014

Conversation

t-8ch
Copy link
Contributor

@t-8ch t-8ch commented Sep 25, 2014

We have to pass urllib3 the url without the authentication information,
else it will be parsed by httplib as a netloc and included in the request line
and Host header

We have to pass urllib3 the url without the authentication information,
else it will be parsed by httplib as a netloc and included in the request line
and Host header
@Lukasa
Copy link
Member

Lukasa commented Sep 25, 2014

This looks right, but it's hard for me to know because URLs are a crazy mess. I'll let @sigmavirus24 review this, he knows URLs better than I do.

@sigmavirus24
Copy link
Contributor

So if we used a better (read: less forgiving) URL parser library we wouldn't need to split on @ (like we do here). In principle this works fine. In reality, we should get something like rfc3986 into acceptable shape for @shazow or just make the Url object in urllib3 more RFC compliant (whichever works better) and use that for parsing the URL and reconstructing it. In short, you have 5 major components of the URL:

{scheme}://{authority}{/path}{?query}{#fragment}

And authority which we're dealing with right now has 3 sub-components so a URL would look like:

{scheme}://{userinfo@}{hostname}{:port}{/path}{?query}{#fragment}

rfc3986 would split this up and allow you to replace userinfo with None and then reconstruct the URL. For a quick fix, this is great. I'd rather not have so much URL/URI parsing logic in requests though, this is an HTTP library not an HTTP + URL + ... library.

@@ -17,7 +17,7 @@
from .packages.urllib3.util import Timeout as TimeoutSauce
from .compat import urlparse, basestring, urldefrag
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the import of urldefrag here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@t-8ch
Copy link
Contributor Author

t-8ch commented Sep 26, 2014

+∞. I think it would be best to have URL objects that are immutable and an API like URL.replace(userinfo=None, fragment=None)

@sigmavirus24
Copy link
Contributor

@t-8ch that's roughly rfc3986's API, except that I don't think I call it replace but maybe I do.... I'll double check later.

@shazow
Copy link
Contributor

shazow commented Sep 26, 2014

@sigmavirus24 Please open the specific issue with urllib3's url parser, no need to be backhanded. :)

@sigmavirus24
Copy link
Contributor

Sorry @shazow, it wasn't meant to be back handed. I'll pull together the list of things the object is missing and make an issue with it tonight.

@shazow
Copy link
Contributor

shazow commented Sep 26, 2014

Thanks. :)

@kennethreitz
Copy link
Contributor

What's the status of this?

@sigmavirus24
Copy link
Contributor

@kennethreitz 👍

kennethreitz added a commit that referenced this pull request Oct 5, 2014
@kennethreitz kennethreitz merged commit 5850b1f into psf:master Oct 5, 2014
@t-8ch t-8ch deleted the fix_2247 branch October 5, 2014 19:18
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants