0001-http-add-vlc_http_cookies_clear.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. From e4f9f7b73e6f833b9696ebe03a0a655d20e30d06 Mon Sep 17 00:00:00 2001
  2. From: Thomas Guillem <thomas@gllm.fr>
  3. Date: Fri, 16 Sep 2016 15:51:10 +0200
  4. Subject: [PATCH 01/17] http: add vlc_http_cookies_clear
  5. Clear all cookies without deleting the jar.
  6. ---
  7. include/vlc_http.h | 1 +
  8. src/libvlccore.sym | 1 +
  9. src/misc/httpcookies.c | 7 +++++--
  10. 3 files changed, 7 insertions(+), 2 deletions(-)
  11. diff --git a/include/vlc_http.h b/include/vlc_http.h
  12. index 383a1ed354..33d04eb749 100644
  13. --- a/include/vlc_http.h
  14. +++ b/include/vlc_http.h
  15. @@ -70,6 +70,7 @@ VLC_API char *vlc_http_auth_FormatAuthorizationHeader
  16. typedef struct vlc_http_cookie_jar_t vlc_http_cookie_jar_t;
  17. VLC_API vlc_http_cookie_jar_t * vlc_http_cookies_new( void ) VLC_USED;
  18. +VLC_API void vlc_http_cookies_clear( vlc_http_cookie_jar_t * p_jar );
  19. VLC_API void vlc_http_cookies_destroy( vlc_http_cookie_jar_t * p_jar );
  20. /**
  21. diff --git a/src/libvlccore.sym b/src/libvlccore.sym
  22. index b704d24f28..7c5c68c581 100644
  23. --- a/src/libvlccore.sym
  24. +++ b/src/libvlccore.sym
  25. @@ -134,6 +134,7 @@ vlc_http_auth_ParseAuthenticationInfoHeader
  26. vlc_http_auth_FormatAuthorizationHeader
  27. vlc_http_cookies_new
  28. vlc_http_cookies_destroy
  29. +vlc_http_cookies_clear
  30. vlc_http_cookies_store
  31. vlc_http_cookies_fetch
  32. httpd_ClientIP
  33. diff --git a/src/misc/httpcookies.c b/src/misc/httpcookies.c
  34. index f4c9682a9e..0e2898f4f6 100644
  35. --- a/src/misc/httpcookies.c
  36. +++ b/src/misc/httpcookies.c
  37. @@ -280,7 +280,7 @@ vlc_http_cookie_jar_t * vlc_http_cookies_new(void)
  38. return jar;
  39. }
  40. -void vlc_http_cookies_destroy( vlc_http_cookie_jar_t * p_jar )
  41. +void vlc_http_cookies_clear( vlc_http_cookie_jar_t * p_jar )
  42. {
  43. if ( !p_jar )
  44. return;
  45. @@ -289,8 +289,11 @@ void vlc_http_cookies_destroy( vlc_http_cookie_jar_t * p_jar )
  46. cookie_destroy( vlc_array_item_at_index( &p_jar->cookies, i ) );
  47. vlc_array_clear( &p_jar->cookies );
  48. - vlc_mutex_destroy( &p_jar->lock );
  49. +}
  50. +void vlc_http_cookies_destroy( vlc_http_cookie_jar_t * p_jar )
  51. +{
  52. + vlc_http_cookies_clear( p_jar );
  53. free( p_jar );
  54. }
  55. --
  56. 2.21.1 (Apple Git-122.3)