Skip to content

urllib.parse doesn't fully comply to RFC 3986 #78541

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

Closed
The-Compiler mannequin opened this issue Aug 8, 2018 · 4 comments
Closed

urllib.parse doesn't fully comply to RFC 3986 #78541

The-Compiler mannequin opened this issue Aug 8, 2018 · 4 comments
Labels
3.7 (EOL) end of life 3.8 (EOL) end of life stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@The-Compiler
Copy link
Mannequin

The-Compiler mannequin commented Aug 8, 2018

BPO 34360
Nosy @orsenthil, @The-Compiler, @native-api, @howinator, @RJ722, @tirkarthi, @websurfer5

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 = None
created_at = <Date 2018-08-08.16:02:35.342>
labels = ['3.7', '3.8', 'type-bug', 'library']
title = "urllib.parse doesn't fully comply to RFC 3986"
updated_at = <Date 2020-08-07.06:49:54.821>
user = 'https://github.com/The-Compiler'

bugs.python.org fields:

activity = <Date 2020-08-07.06:49:54.821>
actor = 'Jeffrey.Kintscher'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2018-08-08.16:02:35.342>
creator = 'The Compiler'
dependencies = []
files = []
hgrepos = []
issue_num = 34360
keywords = []
message_count = 2.0
messages = ['323292', '323362']
nosy_count = 7.0
nosy_names = ['orsenthil', 'The Compiler', 'Ivan.Pozdeev', 'Howie Benefiel', 'RJ722', 'xtreak', 'Jeffrey.Kintscher']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue34360'
versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']

@The-Compiler
Copy link
Mannequin Author

The-Compiler mannequin commented Aug 8, 2018

Since bpo-29651, the urllib.parse docs say:

Unmatched square brackets in the netloc attribute will raise a ValueError.

However, when there are at least one [ and ], but they don't match, there's somewhat inconsistent behavior:

>>> urllib.parse.urlparse('http://[::1]]').hostname
'::1'
>>> urllib.parse.urlparse('http://[[::1]').hostname
'[::1'

@The-Compiler The-Compiler mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Aug 8, 2018
@native-api
Copy link
Mannequin

native-api mannequin commented Aug 10, 2018

I confirm violation of https://tools.ietf.org/html/rfc3986#section-3.2.2 .

URLs are now covered by RFC 3986 which obsoletes RFC 1808 that `urllib's documentation refers to.

This new URL RFC adds [] to 'reserved' characters, so them being present unquoted anywhere where reserved characters are not allowed shall be a parsing error.

@native-api native-api mannequin added 3.7 (EOL) end of life 3.8 (EOL) end of life labels Aug 10, 2018
@native-api native-api mannequin changed the title urllib.parse doesn't fail with multiple unmatching square brackets urllib.parse doesn't fully comply to RFC 3986 Aug 10, 2018
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@The-Compiler
Copy link
Contributor

@picnixz
Copy link
Member

picnixz commented Feb 17, 2025

I'm going to close this one then as completed.

@picnixz picnixz closed this as completed Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.7 (EOL) end of life 3.8 (EOL) end of life 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