]> git.sesse.net Git - vlc/commitdiff
* modules/access/http.c: Do not use vlc_UrlEncode for the same reason
authorChristophe Massiot <massiot@videolan.org>
Sat, 13 Aug 2005 00:14:09 +0000 (00:14 +0000)
committerChristophe Massiot <massiot@videolan.org>
Sat, 13 Aug 2005 00:14:09 +0000 (00:14 +0000)
   than [12145]. We just want to replace spaces.
 * include/network.h: Restored the previous behaviour of vlc_UrlEncode().
   We really mean to URL-encode ? & / etc. in order to be able to pass
   a string containing those special characters as a GET variable in the
   http control interface.

include/network.h
modules/access/http.c

index de146767fec4819a053ab8b0ddf6e1d4e3396fae..ebc712c0393ff73de85f8596a297705fc9756c43 100644 (file)
@@ -222,7 +222,7 @@ static inline int isurlsafe( int c )
          * (even if they are not URL-safe), nor URL-safe characters.
          * We still encode some of them because of Microsoft's crap browser.
          */
-        || ( strchr( "/:.[]@&?-_.", c ) != NULL );
+        || ( strchr( "-_.", c ) != NULL );
 }
 
 /*****************************************************************************
index 327c3f0fc7d4902a6d418af08862030c900fe45e..fd55de0ef469ae0f19910101d7185212e5540d98 100644 (file)
@@ -152,7 +152,7 @@ static int Open( vlc_object_t *p_this )
 {
     access_t     *p_access = (access_t*)p_this;
     access_sys_t *p_sys;
-    char         *psz;
+    char         *psz, *p;
 
     /* Set up p_access */
     p_access->pf_read = Read;
@@ -187,21 +187,12 @@ static int Open( vlc_object_t *p_this )
     p_sys->psz_icy_title = NULL;
     p_sys->i_remaining = 0;
 
-    /* Parse URI */
-    if( vlc_UrlIsNotEncoded( p_access->psz_path ) )
-    {
-        psz = vlc_UrlEncode( p_access->psz_path );
-        if( psz == NULL )
-        {
-            free( p_sys );
-            return VLC_ENOMEM;
-        }
-
-        vlc_UrlParse( &p_sys->url, psz, 0 );
-        free( psz );
-    }
-    else
-        vlc_UrlParse( &p_sys->url, p_access->psz_path, 0 );
+    /* Parse URI - remove spaces */
+    p = psz = strdup( p_access->psz_path );
+    while( (p = strchr( p, ' ' )) != NULL )
+        *p = '+';
+    vlc_UrlParse( &p_sys->url, psz, 0 );
+    free( psz );
 
     if( p_sys->url.psz_host == NULL || *p_sys->url.psz_host == '\0' )
     {