From 5cea088ad25a7ab4dc78f2380033c8538b4c37f6 Mon Sep 17 00:00:00 2001 From: Christophe Massiot Date: Sat, 13 Aug 2005 00:14:09 +0000 Subject: [PATCH] * modules/access/http.c: Do not use vlc_UrlEncode for the same reason 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 | 2 +- modules/access/http.c | 23 +++++++---------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/include/network.h b/include/network.h index de146767fe..ebc712c039 100644 --- a/include/network.h +++ b/include/network.h @@ -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 ); } /***************************************************************************** diff --git a/modules/access/http.c b/modules/access/http.c index 327c3f0fc7..fd55de0ef4 100644 --- a/modules/access/http.c +++ b/modules/access/http.c @@ -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' ) { -- 2.39.2