[vlc-commits] http (old): reject invalid URL
Rémi Denis-Courmont
git at videolan.org
Sat Oct 15 15:10:32 CEST 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Oct 15 16:09:43 2016 +0300| [8234e5423ee4d5134ede5ad963a5829b25817a31] | committer: Rémi Denis-Courmont
http (old): reject invalid URL
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8234e5423ee4d5134ede5ad963a5829b25817a31
---
modules/access/http.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/modules/access/http.c b/modules/access/http.c
index b94a744..23ea5e4 100644
--- a/modules/access/http.c
+++ b/modules/access/http.c
@@ -182,19 +182,20 @@ static int Open( vlc_object_t *p_this )
p_sys->size = 0;
p_access->p_sys = p_sys;
- vlc_http_auth_Init( &p_sys->auth );
- vlc_http_auth_Init( &p_sys->proxy_auth );
- vlc_UrlParse( &p_sys->url, psz_url );
- vlc_credential_init( &credential, &p_sys->url );
-
- if( p_sys->url.psz_host == NULL || *p_sys->url.psz_host == '\0' )
+ if( vlc_UrlParse( &p_sys->url, psz_url ) || p_sys->url.psz_host == NULL )
{
- msg_Warn( p_access, "invalid host" );
- goto error;
+ msg_Err( p_access, "invalid URL" );
+ vlc_UrlClean( &p_sys->url );
+ free( p_sys );
+ return VLC_EGENERIC;
}
if( p_sys->url.i_port <= 0 )
p_sys->url.i_port = 80;
+ vlc_http_auth_Init( &p_sys->auth );
+ vlc_http_auth_Init( &p_sys->proxy_auth );
+ vlc_credential_init( &credential, &p_sys->url );
+
/* Determine the HTTP user agent */
/* See RFC2616 §2.2 token and comment definition, and §3.8 and
* §14.43 user-agent header */
More information about the vlc-commits
mailing list