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
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;
while( *path == '/' )
path++;
- vlc_UrlParse( url, path, 0 );
+ vlc_UrlParse( url, path );
if( url->psz_host == NULL || *url->psz_host == '\0' )
return VLC_EGENERIC;
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 )
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' )
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" );
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 )
{
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
if( http_proxy )
{
p_sys->b_proxy = true;
- vlc_UrlParse( &p_sys->proxy, http_proxy, '?' );
+ vlc_UrlParse( &p_sys->proxy, http_proxy );
}
}
}
/* 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' ) )
{
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" );
/* 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 );
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 ) )
/* 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 );
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;
{
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 );
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;
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 )
{
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 );
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;
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 ) );
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,
{
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=" ) ) )
{
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 )
else
{
vlc_url_t url;
- vlc_UrlParse( &url, psz_url, 0 );
+ vlc_UrlParse( &url, psz_url );
free( psz_url );
if( url.psz_path == NULL )
/!\ NB: this namespace is ONLY usable for interfaces and extensions.
---
----------------------------------------------------------------
-net.url_parse( url, [option delimiter] ): Parse URL. Returns a table with
+net.url_parse( url ): Parse URL. Returns a table with
fields "protocol", "username", "password", "host", "port", path" and
"option".
net.listen_tcp( host, port ): Listen to TCP connections. This returns an
int r;
vlc_url_t url;
- vlc_UrlParse( &url, psz_uri, 0 );
+ vlc_UrlParse( &url, psz_uri );
if( url.psz_protocol )
{
if( url.i_port > 0 )
unsigned port = var_InheritInteger(p_this, portvar);
vlc_url_t url;
- vlc_UrlParse(&url, hostname, 0);
+ vlc_UrlParse(&url, hostname);
free(hostname);
if (url.i_port != 0) {
msg_Err(p_this, "Ignoring port %d (using %d)", url.i_port, port);
assert(b != NULL && !strcmp((a), (b)))
vlc_url_t url;
- vlc_UrlParse( &url, in, '?' );
+ vlc_UrlParse( &url, in );
CHECK( url.psz_protocol, protocol );
CHECK( url.psz_username, user );
CHECK( url.psz_password, pass );
* Splits an URL into parts.
* \param url structure of URL parts [OUT]
* \param str nul-terminated URL string to split
- * \param opt if non-zero, character separating paths from options,
- * normally the question mark
* \note Use vlc_UrlClean() to free associated resources
* \bug Errors cannot be detected.
* \return nothing
*/
-void vlc_UrlParse (vlc_url_t *restrict url, const char *str, unsigned char opt)
+void vlc_UrlParse (vlc_url_t *restrict url, const char *str)
{
url->psz_protocol = NULL;
url->psz_username = NULL;
}
/* Query parameters */
- if (opt != '\0')
+ char *query = strchr (cur, '?');
+ if (query != NULL)
{
- char *query = strchr (cur, opt);
- if (query != NULL)
- {
- *(query++) = '\0';
- url->psz_option = query;
- }
+ *(query++) = '\0';
+ url->psz_option = query;
}
/* Path */