Skip to content

Sometimes URL.human_repr() produces inequivalent URLs #511

@serhiy-storchaka

Description

@serhiy-storchaka

For example:

>>> u = URL('http://bob:%40malware.com%2F@example.org/path')
>>> str(u)
'http://bob:%40malware.com%2F@example.org/path'
>>> u.host
'example.org'
>>> u.human_repr()
'http://bob:@malware.com/@example.org/path'
>>> URL(u.human_repr()).host
'malware.com'

There are similar problems with user, path and query.

I think that human_repr() should produce a string which will produce the equivalent URL when passed to the URL constructor. It means that all corresponding delimiters and % should be %-encoded. It is worth to encode also non-printable characters.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions