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

Felix Paul Kühne fkuehne at videolan.org
Tue Sep 11 13:30:54 CEST 2018


From: Felix Paul Kühne <felix at feepk.net>

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
---
 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 );
 }
 
 /*****************************************************************************
-- 
2.18.0



More information about the vlc-devel mailing list