Commit e48ba9bd authored by Michael Hanselmann's avatar Michael Hanselmann Committed by Rémi Denis-Courmont

Add library functions for HTTP client authentication

These functions can be used by HTTP clients to authenticate against
HTTP servers using the Basic and Digest algorithms as described in
RFC2617.

Most of the code is taken from modules/access/http.c, although it
includes modifications to make it work as library functions and to
fix some issues. The HTTP access module can be converted at a
later point, but there's still some stuff needing cleanup first.

These functions will be used for the Remote Audio Output Protocol
plugin to authenticate VLC against RAOP-compatible devices if the
user enabled password protection.
Signed-off-by: default avatarMichael Hanselmann <public@hansmi.ch>
Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
parent d4304a63
/*****************************************************************************
* vlc_http.h: Shared code for HTTP clients
*****************************************************************************
* Copyright (C) 2001-2008 the VideoLAN team
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Christophe Massiot <massiot@via.ecp.fr>
* Rémi Denis-Courmont <rem # videolan.org>
* Antoine Cellerier <dionoea at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef VLC_HTTP_H
#define VLC_HTTP_H 1
/**
* \file
* This file defines functions, structures, enums and macros shared between
* HTTP clients.
*/
/* RFC 2617: Basic and Digest Access Authentication */
typedef struct http_auth_t
{
char *psz_realm;
char *psz_domain;
char *psz_nonce;
char *psz_opaque;
char *psz_stale;
char *psz_algorithm;
char *psz_qop;
int i_nonce;
char *psz_cnonce;
char *psz_HA1; /* stored H(A1) value if algorithm = "MD5-sess" */
} http_auth_t;
VLC_EXPORT( void, http_auth_Init, ( http_auth_t * ) );
VLC_EXPORT( void, http_auth_Reset, ( http_auth_t * ) );
VLC_EXPORT( void, http_auth_ParseWwwAuthenticateHeader,
( vlc_object_t *, http_auth_t * ,
const char * ) );
VLC_EXPORT( int, http_auth_ParseAuthenticationInfoHeader,
( vlc_object_t *, http_auth_t *,
const char *, const char *,
const char *, const char *,
const char * ) );
VLC_EXPORT( char *, http_auth_FormatAuthorizationHeader,
( vlc_object_t *, http_auth_t *,
const char *, const char *,
const char *, const char * ) );
#endif /* VLC_HTTP_H */
......@@ -66,6 +66,7 @@ pluginsinclude_HEADERS = \
../include/vlc_filter.h \
../include/vlc_fourcc.h \
../include/vlc_gcrypt.h \
../include/vlc_http.h \
../include/vlc_httpd.h \
../include/vlc_image.h \
../include/vlc_input.h \
......@@ -414,6 +415,7 @@ SOURCES_libvlc_common = \
extras/libc.c \
misc/filter.c \
misc/filter_chain.c \
misc/http_auth.c \
$(NULL)
SOURCES_libvlc_httpd = \
......
......@@ -147,6 +147,11 @@ GetFallbackEncoding
GetLang_1
GetLang_2B
GetLang_2T
http_auth_Init
http_auth_Reset
http_auth_ParseWwwAuthenticateHeader
http_auth_ParseAuthenticationInfoHeader
http_auth_FormatAuthorizationHeader
httpd_ClientIP
httpd_ClientModeBidir
httpd_ClientModeStream
......
This diff is collapsed.
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