Commit 7da227d4 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

http: rename http_auth to vlc_http_auth

parent a41e0571
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include <vlc_arrays.h> #include <vlc_arrays.h>
/* RFC 2617: Basic and Digest Access Authentication */ /* RFC 2617: Basic and Digest Access Authentication */
typedef struct http_auth_t typedef struct vlc_http_auth_t
{ {
char *psz_realm; char *psz_realm;
char *psz_domain; char *psz_domain;
...@@ -49,21 +49,20 @@ typedef struct http_auth_t ...@@ -49,21 +49,20 @@ typedef struct http_auth_t
int i_nonce; int i_nonce;
char *psz_cnonce; char *psz_cnonce;
char *psz_HA1; /* stored H(A1) value if algorithm = "MD5-sess" */ char *psz_HA1; /* stored H(A1) value if algorithm = "MD5-sess" */
} http_auth_t; } vlc_http_auth_t;
VLC_API void http_auth_Init( http_auth_t * ); VLC_API void vlc_http_auth_Init( vlc_http_auth_t * );
VLC_API void http_auth_Reset( http_auth_t * ); VLC_API void vlc_http_auth_Reset( vlc_http_auth_t * );
VLC_API void http_auth_ParseWwwAuthenticateHeader VLC_API void vlc_http_auth_ParseWwwAuthenticateHeader
( vlc_object_t *, http_auth_t * , ( vlc_object_t *, vlc_http_auth_t * , const char * );
const char * ); VLC_API int vlc_http_auth_ParseAuthenticationInfoHeader
VLC_API int http_auth_ParseAuthenticationInfoHeader ( vlc_object_t *, vlc_http_auth_t *,
( vlc_object_t *, http_auth_t *,
const char *, const char *, const char *, const char *,
const char *, const char *, const char *, const char *,
const char * ); const char * );
VLC_API char *http_auth_FormatAuthorizationHeader VLC_API char *vlc_http_auth_FormatAuthorizationHeader
( vlc_object_t *, http_auth_t *, ( vlc_object_t *, vlc_http_auth_t *,
const char *, const char *, const char *, const char *,
const char *, const char * ) VLC_USED; const char *, const char * ) VLC_USED;
......
...@@ -134,12 +134,12 @@ struct access_sys_t ...@@ -134,12 +134,12 @@ struct access_sys_t
char *psz_referrer; char *psz_referrer;
char *psz_username; char *psz_username;
char *psz_password; char *psz_password;
http_auth_t auth; vlc_http_auth_t auth;
/* Proxy */ /* Proxy */
bool b_proxy; bool b_proxy;
vlc_url_t proxy; vlc_url_t proxy;
http_auth_t proxy_auth; vlc_http_auth_t proxy_auth;
char *psz_proxy_passbuf; char *psz_proxy_passbuf;
/* */ /* */
...@@ -185,9 +185,9 @@ static void Disconnect( access_t * ); ...@@ -185,9 +185,9 @@ static void Disconnect( access_t * );
static void AuthReply( access_t *p_acces, const char *psz_prefix, static void AuthReply( access_t *p_acces, const char *psz_prefix,
vlc_url_t *p_url, http_auth_t *p_auth ); vlc_url_t *p_url, vlc_http_auth_t *p_auth );
static int AuthCheckReply( access_t *p_access, const char *psz_header, static int AuthCheckReply( access_t *p_access, const char *psz_header,
vlc_url_t *p_url, http_auth_t *p_auth ); vlc_url_t *p_url, vlc_http_auth_t *p_auth );
static vlc_http_cookie_jar_t *GetCookieJar( vlc_object_t *p_this ); static vlc_http_cookie_jar_t *GetCookieJar( vlc_object_t *p_this );
/***************************************************************************** /*****************************************************************************
...@@ -237,8 +237,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -237,8 +237,8 @@ static int Open( vlc_object_t *p_this )
else else
p_sys->cookies = NULL; p_sys->cookies = NULL;
http_auth_Init( &p_sys->auth ); vlc_http_auth_Init( &p_sys->auth );
http_auth_Init( &p_sys->proxy_auth ); vlc_http_auth_Init( &p_sys->proxy_auth );
vlc_UrlParse( &p_sys->url, psz_url ); vlc_UrlParse( &p_sys->url, psz_url );
vlc_credential_init( &credential, &p_sys->url ); vlc_credential_init( &credential, &p_sys->url );
...@@ -470,10 +470,10 @@ static void Close( vlc_object_t *p_this ) ...@@ -470,10 +470,10 @@ static void Close( vlc_object_t *p_this )
access_sys_t *p_sys = p_access->p_sys; access_sys_t *p_sys = p_access->p_sys;
vlc_UrlClean( &p_sys->url ); vlc_UrlClean( &p_sys->url );
http_auth_Reset( &p_sys->auth ); vlc_http_auth_Reset( &p_sys->auth );
if( p_sys->b_proxy ) if( p_sys->b_proxy )
vlc_UrlClean( &p_sys->proxy ); vlc_UrlClean( &p_sys->proxy );
http_auth_Reset( &p_sys->proxy_auth ); vlc_http_auth_Reset( &p_sys->proxy_auth );
free( p_sys->psz_mime ); free( p_sys->psz_mime );
free( p_sys->psz_location ); free( p_sys->psz_location );
...@@ -1276,14 +1276,14 @@ static int Request( access_t *p_access, uint64_t i_tell ) ...@@ -1276,14 +1276,14 @@ static int Request( access_t *p_access, uint64_t i_tell )
else if( !strcasecmp( psz, "www-authenticate" ) ) else if( !strcasecmp( psz, "www-authenticate" ) )
{ {
msg_Dbg( p_access, "Authentication header: %s", p ); msg_Dbg( p_access, "Authentication header: %s", p );
http_auth_ParseWwwAuthenticateHeader( VLC_OBJECT(p_access), vlc_http_auth_ParseWwwAuthenticateHeader( VLC_OBJECT(p_access),
&p_sys->auth, p ); &p_sys->auth, p );
} }
else if( !strcasecmp( psz, "proxy-authenticate" ) ) else if( !strcasecmp( psz, "proxy-authenticate" ) )
{ {
msg_Dbg( p_access, "Proxy authentication header: %s", p ); msg_Dbg( p_access, "Proxy authentication header: %s", p );
http_auth_ParseWwwAuthenticateHeader( VLC_OBJECT(p_access), vlc_http_auth_ParseWwwAuthenticateHeader( VLC_OBJECT(p_access),
&p_sys->proxy_auth, p ); &p_sys->proxy_auth, p );
} }
else if( !strcasecmp( psz, "authentication-info" ) ) else if( !strcasecmp( psz, "authentication-info" ) )
{ {
...@@ -1332,15 +1332,15 @@ static void Disconnect( access_t *p_access ) ...@@ -1332,15 +1332,15 @@ static void Disconnect( access_t *p_access )
*****************************************************************************/ *****************************************************************************/
static void AuthReply( access_t *p_access, const char *psz_prefix, static void AuthReply( access_t *p_access, const char *psz_prefix,
vlc_url_t *p_url, http_auth_t *p_auth ) vlc_url_t *p_url, vlc_http_auth_t *p_auth )
{ {
char *psz_value; char *psz_value;
psz_value = psz_value =
http_auth_FormatAuthorizationHeader( VLC_OBJECT(p_access), p_auth, vlc_http_auth_FormatAuthorizationHeader( VLC_OBJECT(p_access), p_auth,
"GET", p_url->psz_path, "GET", p_url->psz_path,
p_url->psz_username, p_url->psz_username,
p_url->psz_password ); p_url->psz_password );
if ( psz_value == NULL ) if ( psz_value == NULL )
return; return;
...@@ -1349,14 +1349,15 @@ static void AuthReply( access_t *p_access, const char *psz_prefix, ...@@ -1349,14 +1349,15 @@ static void AuthReply( access_t *p_access, const char *psz_prefix,
} }
static int AuthCheckReply( access_t *p_access, const char *psz_header, static int AuthCheckReply( access_t *p_access, const char *psz_header,
vlc_url_t *p_url, http_auth_t *p_auth ) vlc_url_t *p_url, vlc_http_auth_t *p_auth )
{ {
return return
http_auth_ParseAuthenticationInfoHeader( VLC_OBJECT(p_access), p_auth, vlc_http_auth_ParseAuthenticationInfoHeader( VLC_OBJECT(p_access),
psz_header, "", p_auth,
p_url->psz_path, psz_header, "",
p_url->psz_username, p_url->psz_path,
p_url->psz_password ); p_url->psz_username,
p_url->psz_password );
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -126,7 +126,7 @@ struct sout_stream_sys_t ...@@ -126,7 +126,7 @@ struct sout_stream_sys_t
int i_audio_latency; int i_audio_latency;
int i_jack_type; int i_jack_type;
http_auth_t auth; vlc_http_auth_t auth;
/* Send buffer */ /* Send buffer */
size_t i_sendbuf_len; size_t i_sendbuf_len;
...@@ -838,7 +838,7 @@ static int ParseAuthenticateHeader( vlc_object_t *p_this, ...@@ -838,7 +838,7 @@ static int ParseAuthenticateHeader( vlc_object_t *p_this,
goto error; goto error;
} }
http_auth_ParseWwwAuthenticateHeader( p_this, &p_sys->auth, psz_auth ); vlc_http_auth_ParseWwwAuthenticateHeader( p_this, &p_sys->auth, psz_auth );
error: error:
return i_err; return i_err;
...@@ -873,10 +873,10 @@ static int ExecRequest( vlc_object_t *p_this, const char *psz_method, ...@@ -873,10 +873,10 @@ static int ExecRequest( vlc_object_t *p_this, const char *psz_method,
FREENULL( psz_authorization ); FREENULL( psz_authorization );
psz_authorization = psz_authorization =
http_auth_FormatAuthorizationHeader( p_this, &p_sys->auth, vlc_http_auth_FormatAuthorizationHeader( p_this, &p_sys->auth,
psz_method, psz_method,
p_sys->psz_url, "", p_sys->psz_url, "",
p_sys->psz_password ); p_sys->psz_password );
if ( psz_authorization == NULL ) if ( psz_authorization == NULL )
{ {
i_err = VLC_EGENERIC; i_err = VLC_EGENERIC;
...@@ -1397,7 +1397,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -1397,7 +1397,7 @@ static int Open( vlc_object_t *p_this )
p_sys->i_volume = var_GetInteger( p_stream, SOUT_CFG_PREFIX "volume"); p_sys->i_volume = var_GetInteger( p_stream, SOUT_CFG_PREFIX "volume");
p_sys->i_jack_type = JACK_TYPE_NONE; p_sys->i_jack_type = JACK_TYPE_NONE;
http_auth_Init( &p_sys->auth ); vlc_http_auth_Init( &p_sys->auth );
p_sys->psz_host = var_GetNonEmptyString( p_stream, p_sys->psz_host = var_GetNonEmptyString( p_stream,
SOUT_CFG_PREFIX "host" ); SOUT_CFG_PREFIX "host" );
......
...@@ -416,6 +416,7 @@ SOURCES_libvlc_common = \ ...@@ -416,6 +416,7 @@ SOURCES_libvlc_common = \
audio_output/output.c \ audio_output/output.c \
audio_output/volume.c \ audio_output/volume.c \
network/getaddrinfo.c \ network/getaddrinfo.c \
network/http_auth.c \
network/io.c \ network/io.c \
network/tcp.c \ network/tcp.c \
network/udp.c \ network/udp.c \
...@@ -481,7 +482,6 @@ SOURCES_libvlc_common = \ ...@@ -481,7 +482,6 @@ SOURCES_libvlc_common = \
misc/addons.c \ misc/addons.c \
misc/filter.c \ misc/filter.c \
misc/filter_chain.c \ misc/filter_chain.c \
misc/http_auth.c \
misc/httpcookies.c \ misc/httpcookies.c \
misc/fingerprinter.c \ misc/fingerprinter.c \
misc/text_style.c \ misc/text_style.c \
......
...@@ -17,7 +17,7 @@ cat libvlccore.sym | grep -v \ ...@@ -17,7 +17,7 @@ cat libvlccore.sym | grep -v \
-e '^playlist_' -e '^services_discovery_' -e '^intf_' \ -e '^playlist_' -e '^services_discovery_' -e '^intf_' \
-e '^dialog_' -e '^update_' -e '^addons\?_' -e '^fingerprinter_' \ -e '^dialog_' -e '^update_' -e '^addons\?_' -e '^fingerprinter_' \
-e '^text_style_' -e '^text_segment_' \ -e '^text_style_' -e '^text_segment_' \
-e '^net_' -e '^httpd_' -e '^http_auth_' \ -e '^net_' -e '^httpd_' \
-e '^config_' -e '^module_' -e '^var_' \ -e '^config_' -e '^module_' -e '^var_' \
-e '^date_' -e '^sdp_' -e '^plane_' \ -e '^date_' -e '^sdp_' -e '^plane_' \
-e '^us_' -e '^utf8_' -e '^xml_' -e '^str_format_' -e '^GetLang_' \ -e '^us_' -e '^utf8_' -e '^xml_' -e '^str_format_' -e '^GetLang_' \
......
...@@ -134,11 +134,11 @@ FromCharset ...@@ -134,11 +134,11 @@ FromCharset
GetLang_1 GetLang_1
GetLang_2B GetLang_2B
GetLang_2T GetLang_2T
http_auth_Init vlc_http_auth_Init
http_auth_Reset vlc_http_auth_Reset
http_auth_ParseWwwAuthenticateHeader vlc_http_auth_ParseWwwAuthenticateHeader
http_auth_ParseAuthenticationInfoHeader vlc_http_auth_ParseAuthenticationInfoHeader
http_auth_FormatAuthorizationHeader vlc_http_auth_FormatAuthorizationHeader
vlc_http_cookies_new vlc_http_cookies_new
vlc_http_cookies_destroy vlc_http_cookies_destroy
vlc_http_cookies_store vlc_http_cookies_store
......
...@@ -99,7 +99,7 @@ static char *GenerateCnonce() ...@@ -99,7 +99,7 @@ static char *GenerateCnonce()
return psz_md5_hash( &md5 ); return psz_md5_hash( &md5 );
} }
static char *AuthDigest( vlc_object_t *p_this, http_auth_t *p_auth, static char *AuthDigest( vlc_object_t *p_this, vlc_http_auth_t *p_auth,
const char *psz_method, const char *psz_path, const char *psz_method, const char *psz_path,
const char *psz_username, const char *psz_password ) const char *psz_username, const char *psz_password )
{ {
...@@ -228,8 +228,8 @@ error: ...@@ -228,8 +228,8 @@ error:
* acceptable Authorization header is not sent, the server responds with a "401 * acceptable Authorization header is not sent, the server responds with a "401
* Unauthorized" status code, and a WWW-Authenticate header [...] * Unauthorized" status code, and a WWW-Authenticate header [...]
*/ */
void http_auth_ParseWwwAuthenticateHeader( void vlc_http_auth_ParseWwwAuthenticateHeader(
vlc_object_t *p_this, http_auth_t *p_auth, vlc_object_t *p_this, vlc_http_auth_t *p_auth,
const char *psz_header ) const char *psz_header )
{ {
static const char psz_basic_prefix[] = "Basic "; static const char psz_basic_prefix[] = "Basic ";
...@@ -306,8 +306,8 @@ void http_auth_ParseWwwAuthenticateHeader( ...@@ -306,8 +306,8 @@ void http_auth_ParseWwwAuthenticateHeader(
* The Authentication-Info header is used by the server to communicate some * The Authentication-Info header is used by the server to communicate some
* information regarding the successful authentication in the response. * information regarding the successful authentication in the response.
*/ */
int http_auth_ParseAuthenticationInfoHeader( int vlc_http_auth_ParseAuthenticationInfoHeader(
vlc_object_t *p_this, http_auth_t *p_auth, vlc_object_t *p_this, vlc_http_auth_t *p_auth,
const char *psz_header, const char *psz_method, const char *psz_path, const char *psz_header, const char *psz_method, const char *psz_path,
const char *psz_username, const char *psz_password ) const char *psz_username, const char *psz_password )
{ {
...@@ -385,8 +385,8 @@ error: ...@@ -385,8 +385,8 @@ error:
return i_err; return i_err;
} }
char *http_auth_FormatAuthorizationHeader( char *vlc_http_auth_FormatAuthorizationHeader(
vlc_object_t *p_this, http_auth_t *p_auth, vlc_object_t *p_this, vlc_http_auth_t *p_auth,
const char *psz_method, const char *psz_path, const char *psz_method, const char *psz_path,
const char *psz_username, const char *psz_password ) const char *psz_username, const char *psz_password )
{ {
...@@ -486,12 +486,12 @@ error: ...@@ -486,12 +486,12 @@ error:
return psz_result; return psz_result;
} }
void http_auth_Init( http_auth_t *p_auth ) void vlc_http_auth_Init( vlc_http_auth_t *p_auth )
{ {
memset( p_auth, 0, sizeof( *p_auth ) ); memset( p_auth, 0, sizeof( *p_auth ) );
} }
void http_auth_Reset( http_auth_t *p_auth ) void vlc_http_auth_Reset( vlc_http_auth_t *p_auth )
{ {
p_auth->i_nonce = 0; p_auth->i_nonce = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment