[vlc-devel] [PATCH 1/2] http2: fix up URLs

Romain Vimont rom1v at videolabs.io
Fri Oct 9 13:39:50 CEST 2020


On Fri, Oct 09, 2020 at 02:00:18PM +0300, RĂ©mi Denis-Courmont wrote:
> Hi,
> 
> I think the whole point is not to have to fix URLs manually during copy-paste. If you can add quotes, you can substitute white spaces too. In fact, the copied-from application ought to have fixed the URL, so white spaces are less of a problem in this particular context than missing quotes.

This is just shell escaping in order to pass the URL to VLC as-is. This
is very different from URL fixing.

Btw, wget fixes the URL passed as argument automatically:

    $ wget -O- -d 'http://example.com/a b'
    ...
    --2020-10-09 13:14:43--  http://example.com/a%20b
    ...
    ---request begin---
    GET /a%20b HTTP/1.1
    User-Agent: Wget/1.20.3 (linux-gnu)

However, curl does not:

    $ curl -v 'http://example.com/a b'
    ...
    > GET /a b HTTP/1.1
    ...
    > < HTTP/1.0 505 HTTP Version Not Supported

IMO, VLC should fixup the URL passed as argument like wget.

I suggest:

--------8--------------------------------------------------------------
diff --git a/src/libvlc.c b/src/libvlc.c
index c1dcde276d..ad5f300eff 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -442,8 +442,10 @@ static void GetFilenames( libvlc_int_t *p_vlc, unsigned n,
             if( !mrl )
                 continue;
         }
+        else
+            mrl = vlc_uri_fixup(args[n]);
 
-        intf_InsertItem( p_vlc, (mrl != NULL) ? mrl : args[n], i_options,
+        intf_InsertItem( p_vlc, mrl, i_options,
                          ( i_options ? &args[n + 1] : NULL ),
                          VLC_INPUT_OPTION_TRUSTED );
         free( mrl );
--------8--------------------------------------------------------------

Regards


More information about the vlc-devel mailing list