Commit d7a88fe0 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

url: remove vlc_UrlParse() option parameter



That parameter assumed that the query was part of the path. However it
is not, which leads to invalid host name, and eventually failure when
the path is missing. In practice, passing any value other than '?' as
separator would not work properly.

Remaining vlc_UrlParse() call sites without the option separator do not
support query at the protocol level anyway, so they are unaffected by the
change.
Signed-off-by: Rémi Denis-Courmont's avatarRémi Denis-Courmont <remi@remlab.net>
parent 0e4ff269
......@@ -50,6 +50,6 @@ VLC_API char * decode_URI( char *psz );
VLC_API char * encode_URI_component( const char *psz ) VLC_MALLOC;
VLC_API char * make_path( const char *url ) VLC_MALLOC;
VLC_API void vlc_UrlParse (vlc_url_t *, const char *, unsigned char);
VLC_API void vlc_UrlParse (vlc_url_t *, const char *);
VLC_API void vlc_UrlClean (vlc_url_t *);
#endif
......@@ -164,7 +164,7 @@ static int Open( vlc_object_t *p_this )
if( p_sys->p_session == NULL )
goto error;
vlc_UrlParse( &p_sys->url, p_access->psz_location, 0 );
vlc_UrlParse( &p_sys->url, p_access->psz_location );
get_credentials( p_access );
if( get_address( p_access ) != VLC_SUCCESS )
goto error;
......
......@@ -578,7 +578,7 @@ static int parseURL( vlc_url_t *url, const char *path, enum tls_mode_e mode )
while( *path == '/' )
path++;
vlc_UrlParse( url, path, 0 );
vlc_UrlParse( url, path );
if( url->psz_host == NULL || *url->psz_host == '\0' )
return VLC_EGENERIC;
......
......@@ -136,7 +136,7 @@ static int Open( vlc_object_t *p_this )
char *psz_escaped_path;
char *psz_path_begin;
vlc_UrlParse( &url, psz_unescaped, 0 );
vlc_UrlParse( &url, psz_unescaped );
psz_escaped_path = gnome_vfs_escape_path_string( url.psz_path );
if( psz_escaped_path )
......
......@@ -287,7 +287,7 @@ static int OpenRedirected( vlc_object_t *p_this, const char *psz_access,
p = psz = strdup( p_access->psz_location );
while( (p = strchr( p, ' ' )) != NULL )
*p = '+';
vlc_UrlParse( &p_sys->url, psz, '?' );
vlc_UrlParse( &p_sys->url, psz );
free( psz );
if( p_sys->url.psz_host == NULL || *p_sys->url.psz_host == '\0' )
......@@ -372,7 +372,7 @@ static int OpenRedirected( vlc_object_t *p_this, const char *psz_access,
if( psz != NULL )
{
p_sys->b_proxy = true;
vlc_UrlParse( &p_sys->proxy, psz, '?' );
vlc_UrlParse( &p_sys->proxy, psz );
free( psz );
psz = var_InheritString( p_access, "http-proxy-pwd" );
......
......@@ -314,7 +314,7 @@ static int Open ( vlc_object_t *p_this )
vlc_mutex_init(&p_sys->timeout_mutex);
/* parse URL for rtsp://[user:[passwd]@]serverip:port/options */
vlc_UrlParse( &p_sys->url, p_sys->psz_path, '?' );
vlc_UrlParse( &p_sys->url, p_sys->psz_path );
if( ( p_sys->scheduler = BasicTaskScheduler::createNew() ) == NULL )
{
......
......@@ -105,7 +105,7 @@ int MMSHOpen( access_t *p_access )
if( psz_proxy )
{
p_sys->b_proxy = true;
vlc_UrlParse( &p_sys->proxy, psz_proxy, '?' );
vlc_UrlParse( &p_sys->proxy, psz_proxy );
free( psz_proxy );
}
else
......@@ -114,7 +114,7 @@ int MMSHOpen( access_t *p_access )
if( http_proxy )
{
p_sys->b_proxy = true;
vlc_UrlParse( &p_sys->proxy, http_proxy, '?' );
vlc_UrlParse( &p_sys->proxy, http_proxy );
}
}
......@@ -136,7 +136,7 @@ int MMSHOpen( access_t *p_access )
}
/* open a tcp connection */
vlc_UrlParse( &p_sys->url, p_access->psz_location, '?' );
vlc_UrlParse( &p_sys->url, p_access->psz_location );
if( ( p_sys->url.psz_host == NULL ) ||
( *p_sys->url.psz_host == '\0' ) )
{
......
......@@ -105,7 +105,7 @@ int MMSTUOpen( access_t *p_access )
vlc_mutex_init( &p_sys->lock_netwrite );
/* *** Parse URL and get server addr/port and path *** */
vlc_UrlParse( &p_sys->url, p_access->psz_location, '?' );
vlc_UrlParse( &p_sys->url, p_access->psz_location );
if( p_sys->url.psz_host == NULL || *p_sys->url.psz_host == '\0' )
{
msg_Err( p_access, "invalid server name" );
......
......@@ -458,7 +458,7 @@ static int Open( vlc_object_t *p_this )
/* Parse uri params for pre-connect */
vlc_url_t url;
vlc_UrlParse( &url, p_demux->psz_location, 0 );
vlc_UrlParse( &url, p_demux->psz_location );
if ( !EMPTY_STR(url.psz_host) )
p_sys->psz_hostname = strdup( url.psz_host );
......
......@@ -130,7 +130,7 @@ static int Open( vlc_object_t* p_this )
p_sys->i_socket = -1;
/* Parse the URL */
vlc_UrlParse( &url, p_access->psz_location, 0 );
vlc_UrlParse( &url, p_access->psz_location );
/* Check for some parameters */
if( EMPTY_STR( url.psz_host ) )
......
......@@ -442,7 +442,7 @@ static int Open( vlc_object_t *p_this )
/* Parse uri params */
vlc_url_t url;
vlc_UrlParse( &url, p_demux->psz_location, 0 );
vlc_UrlParse( &url, p_demux->psz_location );
if ( !EMPTY_STR(url.psz_host) )
p_sys->p_client->serverHost = strdup( url.psz_host );
......
......@@ -184,7 +184,7 @@ static int Open( vlc_object_t *p_this )
return VLC_EGENERIC;
}
vlc_UrlParse( &url , p_access->psz_path, 0 );
vlc_UrlParse( &url , p_access->psz_path );
if( url.i_port <= 0 )
url.i_port = 8000;
......
......@@ -301,7 +301,7 @@ static int Activate( vlc_object_t *p_this )
{
vlc_url_t url;
vlc_UrlParse( &url, psz_host, 0 );
vlc_UrlParse( &url, psz_host );
msg_Dbg( p_intf, "base: %s, port: %d", url.psz_host, url.i_port );
......
......@@ -54,7 +54,7 @@ Chunk::Chunk (const std::string& url) :
throw VLC_EGENERIC;
vlc_url_t url_components;
vlc_UrlParse(&url_components, url.c_str(), '?');
vlc_UrlParse(&url_components, url.c_str());
if(url_components.psz_path)
path = url_components.psz_path;
......
......@@ -90,7 +90,7 @@ static char *MakeConfig( intf_thread_t *p_intf, const char *name )
else
{
vlc_url_t url;
vlc_UrlParse( &url, psz_host, 0 );
vlc_UrlParse( &url, psz_host );
unsigned i_port = var_InheritInteger( p_intf, "telnet-port" );
if ( url.i_port != 0 )
{
......
......@@ -166,10 +166,9 @@ static void vlclua_fd_unmap_safe( lua_State *L, unsigned idx )
static int vlclua_url_parse( lua_State *L )
{
const char *psz_url = luaL_checkstring( L, 1 );
const char *psz_option = luaL_optstring( L, 2, NULL );
vlc_url_t url;
vlc_UrlParse( &url, psz_url, psz_option?*psz_option:0 );
vlc_UrlParse( &url, psz_url );
lua_newtable( L );
lua_pushstring( L, url.psz_protocol );
......
......@@ -644,7 +644,7 @@ static int Handshake(intf_thread_t *p_this)
goto oom;
/* parse the submission url */
vlc_UrlParse(&p_sys->p_submit_url, psz_url, 0);
vlc_UrlParse(&p_sys->p_submit_url, psz_url);
free(psz_url);
return VLC_SUCCESS;
......
......@@ -256,7 +256,7 @@ static int Open( vlc_object_t *p_this )
vlc_url_t url;
psz_url = var_InheritString( p_vod, "rtsp-host" );
vlc_UrlParse( &url, psz_url, 0 );
vlc_UrlParse( &url, psz_url );
free( psz_url );
p_vod->p_sys = p_sys = malloc( sizeof( vod_sys_t ) );
......
......@@ -543,7 +543,7 @@ MediaServer::~MediaServer()
input_item_t* MediaServer::newItem(const char *objectID, const char *title )
{
vlc_url_t url;
vlc_UrlParse( &url, url_.c_str(), '?' );
vlc_UrlParse( &url, url_.c_str() );
char* psz_url;
if (asprintf( &psz_url, "upnp://%s://%s:%u%s?ObjectID=%s", url.psz_protocol,
......@@ -673,7 +673,7 @@ void MediaServer::fetchContents()
{
const char* objectID = "";
vlc_url_t url;
vlc_UrlParse( &url, access_->psz_location, '?');
vlc_UrlParse( &url, access_->psz_location );
if ( url.psz_option && !strncmp( url.psz_option, "ObjectID=", strlen( "ObjectID=" ) ) )
{
......
......@@ -699,7 +699,7 @@ static void SDPHandleUrl( sout_stream_t *p_stream, const char *psz_url )
sout_stream_sys_t *p_sys = p_stream->p_sys;
vlc_url_t url;
vlc_UrlParse( &url, psz_url, 0 );
vlc_UrlParse( &url, psz_url );
if( url.psz_protocol && !strcasecmp( url.psz_protocol, "http" ) )
{
if( p_sys->p_httpd_file )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment