[vlc-commits] [Git][videolan/vlc][master] 2 commits: ftp: fix missing / after host

Rémi Denis-Courmont (@Courmisch) gitlab at videolan.org
Fri May 27 16:18:05 UTC 2022



Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC


Commits:
bd6acf80 by Marvin Scholz at 2022-05-27T16:06:34+00:00
ftp: fix missing / after host

When accessing an FTP without specifying a path, the generated MRLs
would lack the trailing / after the hostname, leading to a ton of
errors because of bogus hostnames in the MRLs.

- - - - -
e6746e9e by Marvin Scholz at 2022-05-27T16:06:34+00:00
ftp: add comments clarifying URI construction

- - - - -


1 changed file:

- modules/access/ftp.c


Changes:

=====================================
modules/access/ftp.c
=====================================
@@ -1018,6 +1018,7 @@ static int DirRead (stream_t *p_access, input_item_node_t *p_current_node)
 
         struct vlc_memstream ms;
 
+        // Scheme
         vlc_memstream_open(&ms);
         vlc_memstream_puts(&ms, "ftp");
         if (p_sys->tlsmode != NONE)
@@ -1028,17 +1029,27 @@ static int DirRead (stream_t *p_access, input_item_node_t *p_current_node)
         }
         vlc_memstream_puts(&ms, "://");
 
+        // Host
+        // In case of IPv6, enclose in []
         if (strchr(p_sys->url.psz_host, ':') != NULL)
             vlc_memstream_printf(&ms, "[%s]", p_sys->url.psz_host);
         else
             vlc_memstream_puts(&ms, p_sys->url.psz_host);
 
+        // Port
+        // Only print if not the default for the scheme
         if (p_sys->url.i_port != ((p_sys->tlsmode != IMPLICIT) ? IPPORT_FTP
                                                                : IPPORT_FTPS))
             vlc_memstream_printf(&ms, ":%d", p_sys->url.i_port);
 
+        // Separating / after host[:port]
+        vlc_memstream_putc(&ms, '/');
+
+        // Path to the current location, if any
         if (p_sys->url.psz_path != NULL)
-            vlc_memstream_printf(&ms, "/%s", p_sys->url.psz_path);
+            vlc_memstream_puts(&ms, p_sys->url.psz_path);
+
+        // Filename
         vlc_memstream_puts(&ms, psz_filename);
         free(psz_filename);
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/87ef078ce8b256754107367b1d6ead86931ab9d6...e6746e9e17ef5c69940eddaff05a8e50112a5d05

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/87ef078ce8b256754107367b1d6ead86931ab9d6...e6746e9e17ef5c69940eddaff05a8e50112a5d05
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list