0021-http-add-vlc_http_cookies_clear.patch 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. From 70b8d428132968df8e40e4edb6741e03dcf78de3 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 21/21] 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 | 10 ++++++----
  10. 3 files changed, 8 insertions(+), 4 deletions(-)
  11. diff --git a/include/vlc_http.h b/include/vlc_http.h
  12. index ed7e161..da1fe4e 100644
  13. --- a/include/vlc_http.h
  14. +++ b/include/vlc_http.h
  15. @@ -71,6 +71,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 5a7de9e..bbf6ff8 100644
  23. --- a/src/libvlccore.sym
  24. +++ b/src/libvlccore.sym
  25. @@ -137,6 +137,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 b6d174b..2090f69 100644
  35. --- a/src/misc/httpcookies.c
  36. +++ b/src/misc/httpcookies.c
  37. @@ -281,18 +281,20 @@ 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. - int i;
  46. - for( i = 0; i < vlc_array_count( &p_jar->cookies ); i++ )
  47. + for( int i = 0; i < vlc_array_count( &p_jar->cookies ); i++ )
  48. cookie_destroy( vlc_array_item_at_index( &p_jar->cookies, i ) );
  49. vlc_array_clear( &p_jar->cookies );
  50. - vlc_mutex_destroy( &p_jar->lock );
  51. +}
  52. +void vlc_http_cookies_destroy( vlc_http_cookie_jar_t * p_jar )
  53. +{
  54. + vlc_http_cookies_clear( p_jar );
  55. free( p_jar );
  56. }
  57. --
  58. 2.9.3