GNOME Bugzilla – Bug 758389
rtsp-url: unescape special chars in user/pass part of URL
Last modified: 2017-01-09 13:52:36 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
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.
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?
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.
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.
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.
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 :)