Skip to content

Fix SIP URI support for urllib.parse.url{parse,split} (RFC 3261) #146014

@codingjoe

Description

@codingjoe

Bug report

Bug description:

urllib.parse currently supports the SIP URI scheme. However, it mislabels the netloc as the path.

>>> import urllib.parse
>>> urllib.parse.urlparse('sip:user:password@host:port;uri-parameters?headers')
ParseResult(scheme='sip', netloc='', path='user:password@host:port', params='uri-parameters', query='headers', fragment='')

RFC 3261 defines the sip URI without slashes, like so:

sip:user:password@host:port;uri-parameters?headers

The correct ParseResult would be:

>>> urllib.parse.urlparse('sip:user:password@host:port;uri-parameters?headers')
ParseResult(scheme='sip', netloc='user:password@host:port', path='', params='uri-parameters', query='headers', fragment='')

CPython versions tested on:

3.14

Operating systems tested on:

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions