#include <vlc_strings.h>
#include <vlc_rand.h>
#include <vlc_charset.h>
+#include <vlc_url.h>
#include "../libvlc.h"
#include <string.h>
vlc_tls_creds_t *p_tls )
{
httpd_host_t *host;
+ char *hostname = var_InheritString( p_this, hostvar );
unsigned port = var_InheritInteger( p_this, portvar );
+ vlc_url_t url;
+ vlc_UrlParse( &url, hostname, 0 );
+ free( hostname );
+ if( url.i_port != 0 )
+ {
+ msg_Err( p_this, "Ignoring port %d (using %d)", url.i_port, port );
+ msg_Info( p_this, "Specify port %d separately with the "
+ "%s option instead.", url.i_port, portvar );
+ }
+
/* to be sure to avoid multiple creation */
vlc_mutex_lock( &httpd.mutex );
vlc_mutex_unlock( &host->lock );
vlc_mutex_unlock( &httpd.mutex );
+ vlc_UrlClean( &url );
if( p_tls != NULL )
vlc_tls_ServerDelete( p_tls );
return host;
vlc_cond_init( &host->wait );
host->i_ref = 1;
- char *hostname = var_InheritString( p_this, hostvar );
- host->fds = net_ListenTCP( p_this, hostname, port );
- free( hostname );
+ host->fds = net_ListenTCP( p_this, url.psz_host, port );
if( host->fds == NULL )
{
msg_Err( p_this, "cannot create socket(s) for HTTP host" );
TAB_APPEND( httpd.i_host, httpd.host, host );
vlc_mutex_unlock( &httpd.mutex );
+ vlc_UrlClean( &url );
+
return host;
error:
vlc_object_release( host );
}
+ vlc_UrlClean( &url );
+
if( p_tls != NULL )
vlc_tls_ServerDelete( p_tls );