0004-http-add-vlc_http_cookies_clear.patch 2.03 KB
Newer Older
1
From 3e4862b9283804a5e6ce73269095adb8d58e9579 Mon Sep 17 00:00:00 2001
Felix Paul Kühne's avatar
Felix Paul Kühne committed
2 3
From: Thomas Guillem <thomas@gllm.fr>
Date: Fri, 16 Sep 2016 15:51:10 +0200
4
Subject: [PATCH 04/26] http: add vlc_http_cookies_clear
Felix Paul Kühne's avatar
Felix Paul Kühne committed
5 6 7

Clear all cookies without deleting the jar.
---
Thomas Guillem's avatar
Thomas Guillem committed
8 9 10 11
 include/vlc_http.h     | 1 +
 src/libvlccore.sym     | 1 +
 src/misc/httpcookies.c | 7 +++++--
 3 files changed, 7 insertions(+), 2 deletions(-)
Felix Paul Kühne's avatar
Felix Paul Kühne committed
12 13

diff --git a/include/vlc_http.h b/include/vlc_http.h
14
index ed7e1613da..da1fe4ef1a 100644
Felix Paul Kühne's avatar
Felix Paul Kühne committed
15 16 17 18 19 20 21 22 23 24 25
--- a/include/vlc_http.h
+++ b/include/vlc_http.h
@@ -71,6 +71,7 @@ VLC_API char *vlc_http_auth_FormatAuthorizationHeader
 typedef struct vlc_http_cookie_jar_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_clear( vlc_http_cookie_jar_t * p_jar );
 VLC_API void vlc_http_cookies_destroy( vlc_http_cookie_jar_t * p_jar );
 
 /**
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
26
index a15ba0d923..db7f4030b9 100644
Felix Paul Kühne's avatar
Felix Paul Kühne committed
27 28
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
29
@@ -128,6 +128,7 @@ vlc_http_auth_ParseAuthenticationInfoHeader
Felix Paul Kühne's avatar
Felix Paul Kühne committed
30 31 32 33 34 35 36 37
 vlc_http_auth_FormatAuthorizationHeader
 vlc_http_cookies_new
 vlc_http_cookies_destroy
+vlc_http_cookies_clear
 vlc_http_cookies_store
 vlc_http_cookies_fetch
 httpd_ClientIP
diff --git a/src/misc/httpcookies.c b/src/misc/httpcookies.c
Felix Paul Kühne's avatar
Felix Paul Kühne committed
38
index 77ab852b15..f229b85dea 100644
Felix Paul Kühne's avatar
Felix Paul Kühne committed
39 40
--- a/src/misc/httpcookies.c
+++ b/src/misc/httpcookies.c
Thomas Guillem's avatar
Thomas Guillem committed
41
@@ -281,7 +281,7 @@ vlc_http_cookie_jar_t * vlc_http_cookies_new(void)
Felix Paul Kühne's avatar
Felix Paul Kühne committed
42 43 44 45 46 47 48 49
     return jar;
 }
 
-void vlc_http_cookies_destroy( vlc_http_cookie_jar_t * p_jar )
+void vlc_http_cookies_clear( vlc_http_cookie_jar_t * p_jar )
 {
     if ( !p_jar )
         return;
Thomas Guillem's avatar
Thomas Guillem committed
50
@@ -290,8 +290,11 @@ void vlc_http_cookies_destroy( vlc_http_cookie_jar_t * p_jar )
Felix Paul Kühne's avatar
Felix Paul Kühne committed
51 52 53 54 55 56 57 58 59 60 61 62 63
         cookie_destroy( vlc_array_item_at_index( &p_jar->cookies, i ) );
 
     vlc_array_clear( &p_jar->cookies );
-    vlc_mutex_destroy( &p_jar->lock );
+}
 
+void vlc_http_cookies_destroy( vlc_http_cookie_jar_t * p_jar )
+{
+    vlc_http_cookies_clear( p_jar );
     free( p_jar );
 }
 
-- 
64
2.20.1
Felix Paul Kühne's avatar
Felix Paul Kühne committed
65