[vlc-commits] mms: use vlc_getProxyUrl()

Rémi Denis-Courmont git at videolan.org
Wed Nov 2 17:14:20 CET 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Nov  2 18:13:55 2016 +0200| [ac4744b72d0d5fce6f4a1d37cb1777a6c5ae0b9b] | committer: Rémi Denis-Courmont

mms: use vlc_getProxyUrl()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ac4744b72d0d5fce6f4a1d37cb1777a6c5ae0b9b
---

 modules/access/mms/mms.c  |  9 +--------
 modules/access/mms/mmsh.c | 35 ++++++-----------------------------
 2 files changed, 7 insertions(+), 37 deletions(-)

diff --git a/modules/access/mms/mms.c b/modules/access/mms/mms.c
index 7330c39..0adeea2 100644
--- a/modules/access/mms/mms.c
+++ b/modules/access/mms/mms.c
@@ -55,12 +55,6 @@ static void Close( vlc_object_t * );
 #define BITRATE_LONGTEXT N_( \
     "Select the stream with the maximum bitrate under that limit."  )
 
-#define PROXY_TEXT N_("HTTP proxy")
-#define PROXY_LONGTEXT N_( \
-    "HTTP proxy to be used It must be of the form " \
-    "http://[user[:pass]@]myproxy.mydomain:myport/ ; " \
-    "if empty, the http_proxy environment variable will be tried." )
-
 #define TIMEOUT_TEXT N_("TCP/UDP timeout (ms)")
 #define TIMEOUT_LONGTEXT N_("Amount of time (in ms) to wait before aborting network reception of data. Note that there will be 10 retries before completely giving up.")
 
@@ -77,8 +71,7 @@ vlc_module_begin ()
     add_bool( "mms-all", false, ALL_TEXT, ALL_LONGTEXT, true )
     add_integer( "mms-maxbitrate", 0, BITRATE_TEXT, BITRATE_LONGTEXT ,
                  false )
-    add_string( "mmsh-proxy", NULL, PROXY_TEXT, PROXY_LONGTEXT,
-                    false )
+    add_obsolete_string( "mmsh-proxy" ) /* since 3.0.0 */
 
     add_shortcut( "mms", "mmsu", "mmst", "mmsh" )
     set_callbacks( Open, Close )
diff --git a/modules/access/mms/mmsh.c b/modules/access/mms/mmsh.c
index af5894e..240b779 100644
--- a/modules/access/mms/mmsh.c
+++ b/modules/access/mms/mmsh.c
@@ -77,7 +77,6 @@ int MMSHOpen( access_t *p_access )
 {
     access_sys_t    *p_sys;
     char            *psz_location = NULL;
-    char            *psz_proxy;
 
     STANDARD_BLOCK_ACCESS_INIT
 
@@ -87,39 +86,15 @@ int MMSHOpen( access_t *p_access )
 
     /* Handle proxy */
     p_sys->b_proxy = false;
-    memset( &p_sys->proxy, 0, sizeof(p_sys->proxy) );
 
     /* Check proxy */
-    /* TODO reuse instead http-proxy from http access ? */
-    psz_proxy = var_CreateGetNonEmptyString( p_access, "mmsh-proxy" );
-    if( !psz_proxy )
-    {
-        char *psz_http_proxy = var_InheritString( p_access, "http-proxy" );
-        if( psz_http_proxy )
-        {
-            psz_proxy = psz_http_proxy;
-            var_SetString( p_access, "mmsh-proxy", psz_proxy );
-        }
-    }
-
-    if( psz_proxy )
+    char *psz_proxy = vlc_getProxyUrl( p_access->psz_url );
+    if( psz_proxy != NULL )
     {
         p_sys->b_proxy = true;
         vlc_UrlParse( &p_sys->proxy, psz_proxy );
         free( psz_proxy );
-    }
-    else
-    {
-        const char *http_proxy = getenv( "http_proxy" );
-        if( http_proxy )
-        {
-            p_sys->b_proxy = true;
-            vlc_UrlParse( &p_sys->proxy, http_proxy );
-        }
-    }
 
-    if( p_sys->b_proxy )
-    {
         if( ( p_sys->proxy.psz_host == NULL ) ||
             ( *p_sys->proxy.psz_host == '\0' ) )
         {
@@ -172,7 +147,8 @@ int MMSHOpen( access_t *p_access )
     return VLC_SUCCESS;
 
 error:
-    vlc_UrlClean( &p_sys->proxy );
+    if( p_sys->b_proxy )
+        vlc_UrlClean( &p_sys->proxy );
     vlc_UrlClean( &p_sys->url );
     free( p_sys );
     return VLC_EGENERIC;
@@ -189,7 +165,8 @@ void  MMSHClose ( access_t *p_access )
 
     free( p_sys->p_header );
 
-    vlc_UrlClean( &p_sys->proxy );
+    if( p_sys->b_proxy )
+        vlc_UrlClean( &p_sys->proxy );
     vlc_UrlClean( &p_sys->url );
     free( p_sys );
 }



More information about the vlc-commits mailing list