[vlc-commits] http access: retain auth struct for the runtime of the module

Felix Paul Kühne git at videolan.org
Fri Sep 14 10:56:07 CEST 2018


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Mon Sep 10 20:55:11 2018 +0200| [44ee53af7cd97ae2a2c1652d1183693f06c29e00] | committer: Felix Paul Kühne

http access: retain auth struct for the runtime of the module

Previously, it was retained for a given connection only, so all information needed for a digest login was lost as soon as the module was reconnecting due to the expected 401 on attempted basic login

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

 modules/access/http.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/modules/access/http.c b/modules/access/http.c
index 0ffa56b33f..758f93cebf 100644
--- a/modules/access/http.c
+++ b/modules/access/http.c
@@ -269,6 +269,8 @@ static int Open( vlc_object_t *p_this )
         p_sys->url.psz_username = (char *) credential.psz_username;
         p_sys->url.psz_password = (char *) credential.psz_password;
     }
+    vlc_http_auth_Init( &p_sys->auth );
+    vlc_http_auth_Init( &p_sys->proxy_auth );
 
 connect:
     /* Connect */
@@ -356,6 +358,8 @@ error:
     free( p_sys->psz_referrer );
     free( p_sys->psz_username );
     free( p_sys->psz_password );
+    vlc_http_auth_Deinit( &p_sys->auth );
+    vlc_http_auth_Deinit( &p_sys->proxy_auth );
 
     return ret;
 }
@@ -384,6 +388,9 @@ static void Close( vlc_object_t *p_this )
     free( p_sys->psz_username );
     free( p_sys->psz_password );
 
+    vlc_http_auth_Deinit( &p_sys->auth );
+    vlc_http_auth_Deinit( &p_sys->proxy_auth );
+
     Disconnect( p_access );
 }
 
@@ -622,8 +629,6 @@ static int Connect( stream_t *p_access )
     free( p_sys->psz_icy_name );
     free( p_sys->psz_icy_title );
 
-    vlc_http_auth_Init( &p_sys->auth );
-    vlc_http_auth_Init( &p_sys->proxy_auth );
     p_sys->psz_location = NULL;
     p_sys->psz_mime = NULL;
     p_sys->i_icy_meta = 0;
@@ -963,9 +968,6 @@ static void Disconnect( stream_t *p_access )
     if( p_sys->fd != -1)
         net_Close(p_sys->fd);
     p_sys->fd = -1;
-
-    vlc_http_auth_Deinit( &p_sys->auth );
-    vlc_http_auth_Deinit( &p_sys->proxy_auth );
 }
 
 /*****************************************************************************



More information about the vlc-commits mailing list