* HTTP clients.
*/
+#include <vlc_url.h>
+#include <vlc_arrays.h>
+
/* RFC 2617: Basic and Digest Access Authentication */
typedef struct http_auth_t
{
const char *, const char *,
const char *, const char * ) VLC_USED;
+/* RFC 6265: cookies */
+
+typedef struct vlc_array_t vlc_http_cookie_jar_t;
+
+VLC_API vlc_http_cookie_jar_t * vlc_http_cookies_new( void ) VLC_USED;
+VLC_API void vlc_http_cookies_destroy( vlc_http_cookie_jar_t * p_jar );
+
+/**
+ * Parse a value of an incoming Set-Cookie header and append the
+ * cookie to the cookie jar if appropriate.
+ *
+ * @param p_jar cookie jar object
+ * @param psz_cookie_header value of Set-Cookie
+ * @return true, if the cookie was added, false otherwise
+ */
+VLC_API bool vlc_http_cookies_append( vlc_http_cookie_jar_t * p_jar, const char * psz_cookie_header, const vlc_url_t * p_url );
+
+/**
+ * Returns a cookie value that match the given URL.
+ *
+ * @params p_jar a cookie jar
+ * @params p_url the URL for which the cookies are returned
+ * @return A string consisting of semicolon-separated cookie NAME=VALUE pairs.
+ */
+VLC_API char *vlc_http_cookies_for_url( vlc_http_cookie_jar_t * p_jar, const vlc_url_t * p_url );
+
#endif /* VLC_HTTP_H */
libftp_plugin_la_LIBADD = $(SOCKET_LIBS)
access_LTLIBRARIES += libftp_plugin.la
-libhttp_plugin_la_SOURCES = access/http.c access/httpcookies.h access/httpcookies.c
+libhttp_plugin_la_SOURCES = access/http.c
libhttp_plugin_la_LIBADD = $(SOCKET_LIBS)
if HAVE_ZLIB
libhttp_plugin_la_LIBADD += -lz
#include <vlc_input.h>
#include <vlc_md5.h>
#include <vlc_http.h>
-#include "httpcookies.h"
#ifdef HAVE_ZLIB_H
# include <zlib.h>
bool b_persist;
bool b_has_size;
- http_cookie_jar_t * cookies;
+ vlc_http_cookie_jar_t * cookies;
};
/* */
static int OpenWithCookies( vlc_object_t *p_this, const char *psz_access,
- unsigned i_redirect, http_cookie_jar_t *cookies );
+ unsigned i_redirect, vlc_http_cookie_jar_t *cookies );
/* */
static ssize_t Read( access_t *, uint8_t *, size_t );
* @return vlc error codes
*/
static int OpenWithCookies( vlc_object_t *p_this, const char *psz_access,
- unsigned i_redirect, http_cookie_jar_t *cookies )
+ unsigned i_redirect, vlc_http_cookie_jar_t *cookies )
{
access_t *p_access = (access_t*)p_this;
access_sys_t *p_sys;
/* Only forward an store cookies if the corresponding option is activated */
if( var_CreateGetBool( p_access, "http-forward-cookies" ) )
- p_sys->cookies = (cookies != NULL) ? cookies : http_cookies_new();
+ p_sys->cookies = (cookies != NULL) ? cookies : vlc_http_cookies_new();
else
p_sys->cookies = NULL;
Disconnect( p_access );
vlc_tls_Delete( p_sys->p_creds );
- http_cookies_destroy( p_sys->cookies );
+ vlc_http_cookies_destroy( p_sys->cookies );
#ifdef HAVE_ZLIB_H
inflateEnd( &p_sys->inflate.stream );
Disconnect( p_access );
vlc_tls_Delete( p_sys->p_creds );
- http_cookies_destroy( p_sys->cookies );
+ vlc_http_cookies_destroy( p_sys->cookies );
#ifdef HAVE_ZLIB_H
inflateEnd( &p_sys->inflate.stream );
/* Cookies */
if( p_sys->cookies )
{
- char * psz_cookiestring = http_cookies_for_url( p_sys->cookies, &p_sys->url );
+ char * psz_cookiestring = vlc_http_cookies_for_url( p_sys->cookies, &p_sys->url );
if ( psz_cookiestring )
{
msg_Dbg( p_access, "Sending Cookie %s", psz_cookiestring );
{
if( p_sys->cookies )
{
- if ( http_cookies_append( p_sys->cookies, p, &p_sys->url ) )
+ if ( vlc_http_cookies_append( p_sys->cookies, p, &p_sys->url ) )
msg_Dbg( p_access, "Accepting Cookie: %s", p );
else
msg_Dbg( p_access, "Rejected Cookie: %s", p );
+++ /dev/null
-/*****************************************************************************
- * httpcookies.h: HTTP cookie utilities
- *****************************************************************************
- * Copyright (C) 2014 VLC authors and VideoLAN
- * $Id$
- *
- * Authors: Antti Ajanki <antti.ajanki@iki.fi>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 HTTPCOOKIES_H_
-#define HTTPCOOKIES_H_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <vlc_url.h>
-#include <vlc_arrays.h>
-
-typedef struct vlc_array_t http_cookie_jar_t;
-
-http_cookie_jar_t * http_cookies_new( void );
-void http_cookies_destroy( http_cookie_jar_t * p_jar );
-
-/**
- * Parse a value of an incoming Set-Cookie header and append the
- * cookie to the cookie jar if appropriate.
- *
- * @param p_jar cookie jar object
- * @param psz_cookie_header value of Set-Cookie
- * @return true, if the cookie was added, false otherwise
- */
-bool http_cookies_append( http_cookie_jar_t * p_jar, const char * psz_cookie_header, const vlc_url_t * p_url );
-
-/**
- * Returns a cookie value that match the given URL.
- *
- * @params p_jar a cookie jar
- * @params p_url the URL for which the cookies are returned
- * @return A string consisting of semicolon-separated cookie NAME=VALUE pairs.
- */
-char *http_cookies_for_url( http_cookie_jar_t * p_jar, const vlc_url_t * p_url );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
misc/filter.c \
misc/filter_chain.c \
misc/http_auth.c \
+ misc/httpcookies.c \
misc/fingerprinter.c \
misc/text_style.c \
misc/subpicture.c \
http_auth_ParseWwwAuthenticateHeader
http_auth_ParseAuthenticationInfoHeader
http_auth_FormatAuthorizationHeader
+vlc_http_cookies_new
+vlc_http_cookies_destroy
+vlc_http_cookies_append
+vlc_http_cookies_for_url
httpd_ClientIP
httpd_FileDelete
httpd_FileNew
#include <vlc_common.h>
#include <vlc_messages.h>
#include <vlc_strings.h>
-#include "httpcookies.h"
+#include <vlc_http.h>
typedef struct http_cookie_t
{
static bool cookie_domain_is_public_suffix( const char *domain );
static char * cookie_default_path( const char *request_path );
-http_cookie_jar_t * http_cookies_new()
+vlc_http_cookie_jar_t * vlc_http_cookies_new()
{
return vlc_array_new();
}
-void http_cookies_destroy( http_cookie_jar_t * p_jar )
+void vlc_http_cookies_destroy( vlc_http_cookie_jar_t * p_jar )
{
if ( !p_jar )
return;
vlc_array_destroy( p_jar );
}
-bool http_cookies_append( http_cookie_jar_t * p_jar, const char * psz_cookie_header, const vlc_url_t *p_url )
+bool vlc_http_cookies_append( vlc_http_cookie_jar_t * p_jar, const char * psz_cookie_header, const vlc_url_t *p_url )
{
int i;
}
-char *http_cookies_for_url( http_cookie_jar_t * p_jar, const vlc_url_t * p_url )
+char *vlc_http_cookies_for_url( vlc_http_cookie_jar_t * p_jar, const vlc_url_t * p_url )
{
int i;
char *psz_cookiebuf = NULL;