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

RTSPS scheme support in urllib.parse #104554

Closed
zentarim opened this issue May 16, 2023 · 7 comments
Closed

RTSPS scheme support in urllib.parse #104554

zentarim opened this issue May 16, 2023 · 7 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@zentarim
Copy link
Contributor

zentarim commented May 16, 2023

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

There are three valid RTSP schemes:

URI Scheme Description Status Reference
rtsp Real-Time Streaming Protocol (RTSP) Permanent [RFC2326][RFC7826]
rtsps Real-Time Streaming Protocol (RTSP) over TLS Permanent [RFC2326][RFC7826]
rtspu Real-Time Streaming Protocol (RTSP) over unreliable datagram transport Permanent [RFC2326]

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

  • rtsp
  • rtspu

What make impossible to use functions like urllib.parse.urljoin() upon rtsps://* 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 patching urllib/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

@zentarim zentarim added the type-bug An unexpected behavior, bug, or error label May 16, 2023
@terryjreedy
Copy link
Member

All 3 are premanent schemes; RTSPS is RTSP over TLS, while RTSPU is same over unreliable datagram. Can you make a PR?
@orsenthil

@zentarim
Copy link
Contributor Author

All 3 are premanent schemes; RTSPS is RTSP over TLS, while RTSPU is same over unreliable datagram. Can you make a PR? @orsenthil

Sorry, but I did not get you. Who you're asking about a PR? Me or @orsenthil ?

@orsenthil
Copy link
Member

@zentarim thanks for the report. You could submit PR, if you prefer. I guess, my mention was a cc.

@terryjreedy
Copy link
Member

zentarim, I actually meant you. I was not sure if Senthil was currently available. I should have been clearer.

Senthil, since you are available, do you agree that this should be added? Do the suggested additions look right? (I would assume that RTSPS should appear wherever RTSPU does.) New feature or bugfix?

zentarim added a commit to zentarim/cpython that referenced this issue May 18, 2023
RTSPS is the permanent scheme defined in
https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml
alongside RTSP and RTSPU schemes.
zentarim added a commit to zentarim/cpython that referenced this issue May 18, 2023
RTSPS is the permanent scheme defined in
https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml
alongside RTSP and RTSPU schemes.
zentarim added a commit to zentarim/cpython that referenced this issue May 18, 2023
RTSPS is the permanent scheme defined in
https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml

alongside RTSP and RTSPU schemes.
zentarim added a commit to zentarim/cpython that referenced this issue May 18, 2023
RTSPS is the permanent scheme defined in
https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml
alongside RTSP and RTSPU schemes.
@orsenthil
Copy link
Member

do you agree that this should be added?

@terryjreedy - yes. I agree. In previous additions similar to this, we considered this a feature and didn't backport it. I think, it is safer to consider it as feature as changes the behavior.

Although, someone who really needed rtsps protocol parsing without this change, I assume, would have patched the module locally in their code and worked around it.

@arhadthedev arhadthedev added the stdlib Python modules in the Lib dir label Jun 10, 2023
@orsenthil
Copy link
Member

Do the suggested additions look right? (I would assume that RTSPS should appear wherever RTSPU does.)

This looks right to me. Thinking as bug-fix seems alright here.

orsenthil pushed a commit that referenced this issue Jun 13, 2023
* GH-104554: Add RTSPS support to `urllib/parse.py`

RTSPS is the permanent scheme defined in
https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml
alongside RTSP and RTSPU schemes.

* 📜🤖 Added by blurb_it.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 13, 2023
)

* pythonGH-104554: Add RTSPS support to `urllib/parse.py`

RTSPS is the permanent scheme defined in
https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml
alongside RTSP and RTSPU schemes.

* 📜🤖 Added by blurb_it.

---------

(cherry picked from commit f3266c0)

Co-authored-by: zentarim <[email protected]>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jun 13, 2023
)

* pythonGH-104554: Add RTSPS support to `urllib/parse.py`

RTSPS is the permanent scheme defined in
https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml
alongside RTSP and RTSPU schemes.

* 📜🤖 Added by blurb_it.

---------

(cherry picked from commit f3266c0)

Co-authored-by: zentarim <[email protected]>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
ambv pushed a commit that referenced this issue Jul 5, 2023
…105759)

RTSPS is the permanent scheme defined in
https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml
alongside RTSP and RTSPU schemes.

(cherry picked from commit f3266c0)

Co-authored-by: zentarim <[email protected]>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
ambv pushed a commit that referenced this issue Jul 5, 2023
…105760)

RTSPS is the permanent scheme defined in
https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml
alongside RTSP and RTSPU schemes.

---------

(cherry picked from commit f3266c0)

Co-authored-by: zentarim <[email protected]>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
@hauntsaninja
Copy link
Contributor

Looks like this was implemented, thanks all!

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

5 participants