After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 758389 - rtsp-url: unescape special chars in user/pass part of URL
rtsp-url: unescape special chars in user/pass part of URL
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: 1.10.3
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-11-20 11:48 UTC by Stuart
Modified: 2017-01-09 13:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add parsing of special encoded chars in URL (2.36 KB, patch)
2015-11-20 11:48 UTC, Stuart
none Details | Review
Updated to remove decoding of + into space (1.73 KB, patch)
2015-11-24 14:40 UTC, Martin Sherburn
none Details | Review
Latest using g_uri_unescape_segment() (1.06 KB, patch)
2015-11-25 11:37 UTC, Stuart
committed Details | Review

Description Stuart 2015-11-20 11:48:33 UTC
Created attachment 315962 [details] [review]
Add parsing of special encoded chars in URL

Hi All, 

Please find attached patch to enable the use of encoded special characters within a RTSP URL as per RFC1738 Section 2.2

Currently:

a) rtsp://admin:@dm:n@<IP-ADDR>:8554/stream Doesn't work (correct)

b) rtsp://admin:%40dm%3An@<IP-ADDR>:8554/stream Doesn't work (incorrect)


The patch allows b) to be parsed correctly and connect successfully when special characters are used in the username/password.

e.g. 
    rtsp://admin:%40dm%3An@<IP-ADDR>:8554/stream

now results in:
    username: admin
    password: @dm:n

Hopefully everything is correct, but let me know if any changes may be required!

Regards,
Stuart
Comment 1 Martin Sherburn 2015-11-24 14:40:09 UTC
Created attachment 316170 [details] [review]
Updated to remove decoding of + into space

It seems that spaces should not be encoded as +, so I think the case that chances for "+" and converts to " " should be removed. Updated attached patch (see attached).

FYI (more recent RFC here http://www.faqs.org/rfcs/rfc3986.html)

Regards,

Martin.
Comment 2 Sebastian Dröge (slomo) 2015-11-24 16:25:09 UTC
Maybe instead of fixing this code it could be ported to GstUri instead :) Seems better to have this code at a single place

What do you think?
Comment 3 Martin Sherburn 2015-11-24 16:41:03 UTC
Seems like a good idea but that's a pretty big change I think and would need a lot of testing to make sure things don't break (including IPv6). But having looked at GstUri it seems there is already a function called g_uri_unescape_segment which essentially does the same as gst_rtsp_url_decode_hex_usrpwd. We could just use that function and then the patch is only changing 2 lines of code.
Comment 4 Sebastian Dröge (slomo) 2015-11-24 17:12:07 UTC
I think just using that function as a first step would be good enough, but then as a second patch switching everything over to GstUri would be good too. The changes should actually be quite small, mostly removing code :) We can then give it some wider testing.

But in general, GstUri already has lots of unit tests so I don't expect too many surprises there. But especially for a patch to be backported to 1.6, the small change would be best.
Comment 5 Stuart 2015-11-25 11:37:13 UTC
Created attachment 316229 [details] [review]
Latest using g_uri_unescape_segment()

Hi Sebastian, 

As suggested, patch is updated to use g_uri_unescape_segment() for now.
Comment 6 Tim-Philipp Müller 2016-12-25 12:10:38 UTC
Thanks, pushed:

commit 0cf08d90c0b6a2a795d53e124eaa80dee285f81d
Author: Stuart Weaver <stuart.weaver@datapath.co.uk>
Date:   Wed Nov 25 11:30:42 2015 +0000

    rtsp-url: unescape special chars in user/pass part of URL
    
    This way special characters such as '@' can be used in
    usernames or passwords, e.g.
    
      rtsp://view:%40dm%4An@<IP-ADDR>/media/camera1
    
    will now parse username and password into:
    
      User: view
      Pass: @dm:n
    
    https://bugzilla.gnome.org/show_bug.cgi?id=758389

Sorry for the delay :)