input: Support file://localhost/file type url.
authorPierre d'Herbemont <pdherbemont@free.fr>
Mon, 29 Jun 2009 03:18:17 +0000 (20:18 -0700)
committerPierre d'Herbemont <pdherbemont@free.fr>
Mon, 29 Jun 2009 03:20:00 +0000 (20:20 -0700)
src/input/input.c

index 6bbaba8..d9133b1 100644 (file)
@@ -2358,12 +2358,18 @@ static int InputSourceInit( input_thread_t *p_input,
             && psz_path[0] != DIR_SEP_CHAR
 #endif
           )
-        {   /* host specified -> not supported currently */
-            msg_Err( p_input, "cannot open remote file `%s://%s'",
-                     psz_access, psz_path );
-            msg_Info( p_input, "Did you mean `%s:///%s'?",
-                      psz_access, psz_path );
-            goto error;
+        {   /* host specified -> only localhost is supported */
+            static const unsigned localhostLen = 9; /* strlen("localhost") */
+            if (!strncmp( psz_path, "localhost" DIR_SEP, localhostLen + 1))
+                psz_path += localhostLen;
+            else
+            {
+                msg_Err( p_input, "cannot open remote file `%s://%s'",
+                        psz_access, psz_path );
+                msg_Info( p_input, "Did you mean `%s:///%s'?",
+                         psz_access, psz_path );
+                goto error;
+            }
         }
         /* Remove HTML anchor if present (not supported). */
         char *p = strchr( psz_path, '#' );