1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- From f72729af3b7015a5b98817ec1813b60ed5405663 Mon Sep 17 00:00:00 2001
- From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <felix@feepk.net>
- Date: Mon, 10 Sep 2018 20:55:11 +0200
- Subject: [PATCH 08/17] 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
- ---
- modules/access/http.c | 9 +++++++--
- src/network/http_auth.c | 17 ++++++++++++++++-
- 2 files changed, 23 insertions(+), 3 deletions(-)
- diff --git a/modules/access/http.c b/modules/access/http.c
- index 4384e2b0a3..1a112b9ec1 100644
- --- a/modules/access/http.c
- +++ b/modules/access/http.c
- @@ -271,6 +271,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 */
- @@ -358,6 +360,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;
- }
- @@ -386,6 +390,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 );
- }
-
- @@ -624,8 +631,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;
- diff --git a/src/network/http_auth.c b/src/network/http_auth.c
- index ff1796c25d..939e493b76 100644
- --- a/src/network/http_auth.c
- +++ b/src/network/http_auth.c
- @@ -242,7 +242,10 @@ void vlc_http_auth_ParseWwwAuthenticateHeader(
- /* 2 Basic Authentication Scheme */
- msg_Dbg( p_this, "Using Basic Authentication" );
- psz_header += sizeof( psz_basic_prefix ) - 1;
- +
- + free( p_auth->psz_realm );
- p_auth->psz_realm = AuthGetParam( psz_header, "realm" );
- +
- if ( p_auth->psz_realm == NULL )
- msg_Warn( p_this, "Basic Authentication: "
- "Mandatory 'realm' parameter is missing" );
- @@ -258,12 +261,24 @@ void vlc_http_auth_ParseWwwAuthenticateHeader(
- return;
-
- psz_header += sizeof( psz_digest_prefix ) - 1;
- + p_auth->psz_nonce = AuthGetParam( psz_header, "nonce" );
- +
- + free( p_auth->psz_realm );
- p_auth->psz_realm = AuthGetParam( psz_header, "realm" );
- +
- + free( p_auth->psz_domain );
- p_auth->psz_domain = AuthGetParam( psz_header, "domain" );
- - p_auth->psz_nonce = AuthGetParam( psz_header, "nonce" );
- +
- + free( p_auth->psz_opaque );
- p_auth->psz_opaque = AuthGetParam( psz_header, "opaque" );
- +
- + free( p_auth->psz_stale );
- p_auth->psz_stale = AuthGetParamNoQuotes( psz_header, "stale" );
- +
- + free( p_auth->psz_algorithm );
- p_auth->psz_algorithm = AuthGetParamNoQuotes( psz_header, "algorithm" );
- +
- + free( p_auth->psz_qop );
- p_auth->psz_qop = AuthGetParam( psz_header, "qop" );
- p_auth->i_nonce = 0;
-
- --
- 2.21.1 (Apple Git-122.3)
|