X Tutup
The Wayback Machine - https://web.archive.org/web/20241217043355/https://github.com/python/cpython/issues/60338
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

Add support for RTMP schemes to urlparse #60338

Open
JorgeGomes mannequin opened this issue Oct 4, 2012 · 6 comments
Open

Add support for RTMP schemes to urlparse #60338

JorgeGomes mannequin opened this issue Oct 4, 2012 · 6 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@JorgeGomes
Copy link
Mannequin

JorgeGomes mannequin commented Oct 4, 2012

BPO 16134
Nosy @gpshead, @orsenthil, @ericvsmith, @vadmium

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 2012-10-04.18:39:21.703>
labels = ['type-feature', 'library']
title = 'Add support for RTMP schemes to urlparse'
updated_at = <Date 2013-11-24.02:51:13.690>
user = 'https://bugs.python.org/JorgeGomes'

bugs.python.org fields:

activity = <Date 2013-11-24.02:51:13.690>
actor = 'martin.panter'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2012-10-04.18:39:21.703>
creator = 'Jorge.Gomes'
dependencies = []
files = []
hgrepos = []
issue_num = 16134
keywords = []
message_count = 6.0
messages = ['171984', '171985', '172448', '172449', '204079', '204170']
nosy_count = 5.0
nosy_names = ['gregory.p.smith', 'orsenthil', 'eric.smith', 'martin.panter', 'Jorge.Gomes']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue16134'
versions = ['Python 3.4']

@JorgeGomes
Copy link
Mannequin Author

JorgeGomes mannequin commented Oct 4, 2012

Please add support in urlparse for the family of RTMP schemes:
rtmp
rtmpe
rtmps
rtmpt

I believe these schemes should be added to the following module variables:
uses_relative
uses_netloc
uses_params
uses_query
[essentially, the one where rtsp already is]

The RTMP spec is hosted at http://www.adobe.com/devnet/rtmp.html which describes the format as "protocol://servername:port/"
The example provided there is rtmp://localhost:1935/test

An example YouTube RTMP *service* URL looks like:
rtmp://a.rtmp.youtube.com/videolive?ns=yt-live&id=123456&itag=35&signature=blahblahblah

Please let me know if further information is required.

Thanks!

========================================
Footnote:

A full YouTube RTMP stream URL may look like this:

rtmp://a.rtmp.youtube.com/videolive?ns=yt-live&id=123456&itag=35&signature=blahblahblah/yt-live.123456.35

i.e. it is the stream service url suffixed with '/' + the_stream_name.

When one uses urlparse (extended with the 'rtmp' scheme), the stream name part gets lumped in with the last query value.
I think it's reasonable to expect the user of the urlparse library to strip the stream name off, thus returning just the service URL, which can be parsed normally. However, if urlparse could handle this sort use-case generically, then that would be great.

@JorgeGomes JorgeGomes mannequin added the type-feature A feature request or enhancement label Oct 4, 2012
@ericvsmith
Copy link
Member

As this is a feature request, it can only be applied to 3.4. I've modified the versions.

@ericvsmith ericvsmith added the stdlib Python modules in the Lib dir label Oct 4, 2012
@gpshead gpshead self-assigned this Oct 5, 2012
@orsenthil
Copy link
Member

Personally, I want to do away with all those scheme specific stuff, if we can. I have tried previously, but failed due to some backwards incompatibility. 3.4 gives a good chance/time to make those changes to get rid of those scheme specific stuff (again).

So, instead of adding the rmtp* modules to the various categories, I would like to see if can find a way out.

bpo-9374 - another related one which.

Also, Jorge Gomes: If you care about 2.7 version only, then the way I have seen this issue being handled in production is you extend the uses_relative list with the protocols that you want to support.
Like

>> from urlparse import uses_netloc
>> uses_netloc.extend(['rtmp','rtmpe'])

2.7.x is in bugfix mode and this change may not be considered a bug-fix to find it's place in 2.7.x

@orsenthil
Copy link
Member

bpo-9374 - another related one which should be taken care. Which is simply reverting this: http://hg.python.org/cpython/diff/a0b3cb52816e/Lib/urllib/parse.py and informing in the DOCs that those globals are not available anymore. (But this should also be discussed in python-dev before making the change).

@gpshead
Copy link
Member

gpshead commented Nov 23, 2013

i'd like to see a proposed change against the 3.4 standard library for this with tests.

@gpshead gpshead removed their assignment Nov 23, 2013
@vadmium
Copy link
Member

vadmium commented Nov 24, 2013

Looks like bpo-9374 already covers most of this, with fixes in 2.7, 3.2 and 3.3.

$ python3.3
Python 3.3.2 (default, May 16 2013, 23:40:52) 
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from urllib.parse import urlparse
>>> urlparse("protocol://servername:port/")
ParseResult(scheme='protocol', netloc='servername:port', path='/', params='', query='', fragment='')
>>> urlparse("rtmp://a.rtmp.youtube.com/videolive?ns=yt-live&id=123456&itag=35&signature=blahblahblah/yt-live.123456.35")
ParseResult(scheme='rtmp', netloc='a.rtmp.youtube.com', path='/videolive', params='', query='ns=yt-live&id=123456&itag=35&signature=blahblahblah/yt-live.123456.35', fragment='')

Now there are only the three unresolved aspects listed below, as I see it. Personally I think the first, for urljoin(), should be fixed (hopefully in a generic way without whitelists). I mentioned this in bpo-18828. I wonder if last two really matter?

  • uses_relative: would allow urljoin() to work. Compare urljoin("rtmp://host/", "path") and urljoin("rtsp://host/", "path").
  • uses_netloc: would affect urlunsplit(("rtmp", "", "/path", "", ""))
  • uses_params: would affect urlparse("rtmp://host/;a=b")

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
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-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

4 participants
X Tutup