Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

RTSPS scheme support in urllib.parse #104554

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

Description

@zentarim

In accordance with
https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml

There are three valid RTSP schemes:

URI SchemeDescriptionStatusReference
rtspReal-Time Streaming Protocol (RTSP)Permanent[RFC2326][RFC7826]
rtspsReal-Time Streaming Protocol (RTSP) over TLSPermanent[RFC2326][RFC7826]
rtspuReal-Time Streaming Protocol (RTSP) over unreliable datagram transportPermanent[RFC2326]

But inurllib/parse.py only two of them are defined:

  • rtsp
  • rtspu

What make impossible to use functions likeurllib.parse.urljoin() uponrtsps://* URLs:

Type "help", "copyright", "credits" or "license" for more information.>>> from urllib.parse import urljoin>>> urljoin('rtsps://127.0.0.1/foo/bar', 'trackID=1')'trackID=1'

Expected result is:

Type "help", "copyright", "credits" or "license" for more information.>>> from urllib.parse import urljoin>>> urljoin('rtsps://127.0.0.1/foo/bar', 'trackID=1')'rtsps://127.0.0.1/foo/trackID=1'>>>

I was able to get the expected behavior by patchingurllib/parsing.py:

--- parse.py.bak        2023-05-16 16:16:01.910634526 +0000+++ parse.py    2023-05-16 16:17:35.793154580 +0000@@ -46,17 +46,17 @@  uses_relative = ['', 'ftp', 'http', 'gopher', 'nntp', 'imap',                  'wais', 'file', 'https', 'shttp', 'mms',-                 'prospero', 'rtsp', 'rtspu', 'sftp',+                 'prospero', 'rtsp', 'rtsps', 'rtspu', 'sftp',                  'svn', 'svn+ssh', 'ws', 'wss']  uses_netloc = ['', 'ftp', 'http', 'gopher', 'nntp', 'telnet',                'imap', 'wais', 'file', 'mms', 'https', 'shttp',-               'snews', 'prospero', 'rtsp', 'rtspu', 'rsync',+               'snews', 'prospero', 'rtsp', 'rtsps', 'rtspu', 'rsync',                'svn', 'svn+ssh', 'sftp', 'nfs', 'git', 'git+ssh',                'ws', 'wss']  uses_params = ['', 'ftp', 'hdl', 'prospero', 'http', 'imap',-               'https', 'shttp', 'rtsp', 'rtspu', 'sip', 'sips',+               'https', 'shttp', 'rtsp', 'rtsps', 'rtspu', 'sip', 'sips',                'mms', 'sftp', 'tel']  # These are not actually used anymore, but should stay for backwards@@ -66,7 +66,7 @@                     'telnet', 'wais', 'imap', 'snews', 'sip', 'sips']  uses_query = ['', 'http', 'wais', 'imap', 'https', 'shttp', 'mms',-              'gopher', 'rtsp', 'rtspu', 'sip', 'sips']+              'gopher', 'rtsp', 'rtsps', 'rtspu', 'sip', 'sips']  uses_fragment = ['', 'ftp', 'hdl', 'http', 'gopher', 'news',                  'nntp', 'wais', 'https', 'shttp', 'snews',

The issue presents in Python versions:

  • 3.10.6
  • 3.12.0a7

Linked PRs

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp