[vlc-commits] http: supersede domainless cookies

Pierre Ynard git at videolan.org
Mon May 14 03:54:37 CEST 2012


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Mon May 14 03:49:44 2012 +0200| [ca0c548cb9597b3b3e6845de78b2c14303c1b221] | committer: Pierre Ynard

http: supersede domainless cookies

The scope of cookies without a domain is limited to the current server.
The current logic is always wrong because either it's the same server
and the new cookie should supersede the old one, or it's a different
server and the old cookie should not be sent. This logic is still far
from RFC-compliant, but at least it should get it right some of the time.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ca0c548cb9597b3b3e6845de78b2c14303c1b221
---

 modules/access/http.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/access/http.c b/modules/access/http.c
index 9817bca..f7a1e85 100644
--- a/modules/access/http.c
+++ b/modules/access/http.c
@@ -1720,8 +1720,10 @@ static void cookie_append( vlc_array_t * cookies, char * cookie )
 
         assert( current_cookie_name );
 
-        bool is_domain_matching = ( cookie_domain && current_cookie_domain &&
-                                         !strcmp( cookie_domain, current_cookie_domain ) );
+        bool is_domain_matching = (
+                      ( !cookie_domain && !current_cookie_domain ) ||
+                      ( cookie_domain && current_cookie_domain &&
+                        !strcmp( cookie_domain, current_cookie_domain ) ) );
 
         if( is_domain_matching && !strcmp( cookie_name, current_cookie_name )  )
         {



More information about the vlc-commits mailing list