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

urlparse.urljoin of simple "http://" and "somedomain.com" produces incorrect result #51346

Closed
ssteiner mannequin opened this issue Oct 10, 2009 · 4 comments
Closed

urlparse.urljoin of simple "http://" and "somedomain.com" produces incorrect result #51346

ssteiner mannequin opened this issue Oct 10, 2009 · 4 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@ssteiner
Copy link
Mannequin

ssteiner mannequin commented Oct 10, 2009

BPO 7097
Nosy @brettcannon, @orsenthil

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:

assignee = None
closed_at = <Date 2009-10-10.18:26:34.575>
created_at = <Date 2009-10-10.17:40:12.896>
labels = ['invalid', 'type-bug', 'library']
title = 'urlparse.urljoin of simple "http://" and "somedomain.com" produces incorrect result'
updated_at = <Date 2012-01-29.22:46:58.021>
user = 'https://bugs.python.org/ssteiner'

bugs.python.org fields:

activity = <Date 2012-01-29.22:46:58.021>
actor = 'orsenthil'
assignee = 'none'
closed = True
closed_date = <Date 2009-10-10.18:26:34.575>
closer = 'brett.cannon'
components = ['Library (Lib)']
creation = <Date 2009-10-10.17:40:12.896>
creator = 'ssteiner'
dependencies = []
files = []
hgrepos = []
issue_num = 7097
keywords = []
message_count = 4.0
messages = ['93834', '93836', '151929', '152273']
nosy_count = 4.0
nosy_names = ['brett.cannon', 'ssteiner', 'orsenthil', 'mnot']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue7097'
versions = ['Python 2.6']

@ssteiner
Copy link
Mannequin Author

ssteiner mannequin commented Oct 10, 2009

Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from urlparse import urljoin
>>> urljoin("http://", "somedomain.com")
'http:///somedomain.com'

Note the three leading slashes, should be "http://somedomain.com"

@ssteiner ssteiner mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Oct 10, 2009
@brettcannon
Copy link
Member

urlparse.urljoin() is meant to join together a base URL with other URL
parts. The protocol is part of the base URL and thus not supported by
urlparse.urljoin().

@mnot
Copy link
Mannequin

mnot mannequin commented Jan 25, 2012

http: and http:// are both valid base URIs; see RFC3986.

More to the point, it's a useful thing to use a scheme as a base URI; many users omit the HTTP:// from their URIs.

@orsenthil
Copy link
Member

>>> urljoin("http://", "//somedomain.com")
results in "http://somedomain.com"

So, I wonder if this way to specify the relative url properly and not the base-url.

The test suite of urlparse tries to follow all the advertised scenarios for RFC3986 and also some more tests (which are usually discovered by de-facto scenarios of how other clients (mainly browsers) deal with it. If there is a browser behavior which we should emulate, without breaking existing code, we should consider this, otherwise we could leave this in invalid state. Thanks!

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants