1 /*****************************************************************************
2 * vlc_http.h: Shared code for HTTP clients
3 *****************************************************************************
4 * Copyright (C) 2001-2008 VLC authors and VideoLAN
6 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
7 * Christophe Massiot <massiot@via.ecp.fr>
9 * Antoine Cellerier <dionoea at videolan dot org>
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation; either version 2.1 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with this program; if not, write to the Free Software Foundation,
23 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24 *****************************************************************************/
31 * This file defines functions, structures, enums and macros shared between
36 #include <vlc_arrays.h>
38 /* RFC 2617: Basic and Digest Access Authentication */
39 typedef struct vlc_http_auth_t
50 char *psz_HA1
; /* stored H(A1) value if algorithm = "MD5-sess" */
54 VLC_API
void vlc_http_auth_Init( vlc_http_auth_t
* );
55 VLC_API
void vlc_http_auth_Deinit( vlc_http_auth_t
* );
56 VLC_API
void vlc_http_auth_ParseWwwAuthenticateHeader
57 ( vlc_object_t
*, vlc_http_auth_t
* , const char * );
58 VLC_API
int vlc_http_auth_ParseAuthenticationInfoHeader
59 ( vlc_object_t
*, vlc_http_auth_t
*,
60 const char *, const char *,
61 const char *, const char *,
63 VLC_API
char *vlc_http_auth_FormatAuthorizationHeader
64 ( vlc_object_t
*, vlc_http_auth_t
*,
65 const char *, const char *,
66 const char *, const char * ) VLC_USED
;
68 /* RFC 6265: cookies */
70 typedef struct vlc_http_cookie_jar_t vlc_http_cookie_jar_t
;
72 VLC_API vlc_http_cookie_jar_t
* vlc_http_cookies_new( void ) VLC_USED
;
73 VLC_API
void vlc_http_cookies_destroy( vlc_http_cookie_jar_t
* p_jar
);
76 * Parse a value of an incoming Set-Cookie header and append the
77 * cookie to the cookie jar if appropriate.
79 * @param jar cookie jar object
80 * @param cookie header field value of Set-Cookie
81 * @return true, if the cookie was added, false otherwise
83 VLC_API
bool vlc_http_cookies_store( vlc_http_cookie_jar_t
*jar
,
84 const char *cookie
, const char *host
, const char *path
);
87 * Returns a cookie value that match the given URL.
89 * @param p_jar a cookie jar
90 * @param p_url the URL for which the cookies are returned
91 * @return A string consisting of semicolon-separated cookie NAME=VALUE pairs.
93 VLC_API
char *vlc_http_cookies_fetch( vlc_http_cookie_jar_t
*jar
, bool secure
,
94 const char *host
, const char *path
);
96 #endif /* VLC_HTTP_H */