vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Wed Jun 27 19:33:10 2018 +0300| [8e1fcb90815408e5eab7dc269c8acdfc578ebaa9] | committer: Rémi Denis-Courmont
httpd: fix parsing hostname variable The variable is a hostname / address, not an URL. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8e1fcb90815408e5eab7dc269c8acdfc578ebaa9 --- src/network/httpd.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/network/httpd.c b/src/network/httpd.c index ce2b6a8163..8fa261f190 100644 --- a/src/network/httpd.c +++ b/src/network/httpd.c @@ -910,18 +910,8 @@ static httpd_host_t *httpd_HostCreate(vlc_object_t *p_this, 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); - 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); @@ -936,7 +926,6 @@ static httpd_host_t *httpd_HostCreate(vlc_object_t *p_this, atomic_fetch_add_explicit(&host->ref, 1, memory_order_relaxed); vlc_mutex_unlock(&httpd.mutex); - vlc_UrlClean(&url); vlc_tls_Delete(p_tls); return host; } @@ -951,7 +940,11 @@ static httpd_host_t *httpd_HostCreate(vlc_object_t *p_this, vlc_cond_init(&host->wait); atomic_init(&host->ref, 1); - host->fds = net_ListenTCP(p_this, url.psz_host, port); + char *hostname = var_InheritString(p_this, hostvar); + + host->fds = net_ListenTCP(p_this, hostname, port); + free(hostname); + if (!host->fds) { msg_Err(p_this, "cannot create socket(s) for HTTP host"); goto error; @@ -975,8 +968,6 @@ static httpd_host_t *httpd_HostCreate(vlc_object_t *p_this, vlc_list_append(&host->node, &httpd.hosts); vlc_mutex_unlock(&httpd.mutex); - vlc_UrlClean(&url); - return host; error: @@ -989,7 +980,6 @@ error: vlc_object_release(host); } - vlc_UrlClean(&url); vlc_tls_Delete(p_tls); return NULL; } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
