[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 49/178: cookie: case-insensitive hashing for the do
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 49/178: cookie: case-insensitive hashing for the domains |
Date: |
Wed, 23 May 2018 12:24:44 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 746479adcbd2bba06077642fefe0414ad6e1e0ea
Author: Lauri Kasanen <address@hidden>
AuthorDate: Thu Apr 5 15:55:59 2018 +0300
cookie: case-insensitive hashing for the domains
closes #2458
---
lib/cookie.c | 19 +++++++++++++++++--
tests/data/test46 | 2 +-
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/lib/cookie.c b/lib/cookie.c
index ec3b1bf9a..5aa959690 100644
--- a/lib/cookie.c
+++ b/lib/cookie.c
@@ -90,7 +90,6 @@ Example set of cookies:
#include "urldata.h"
#include "cookie.h"
-#include "hash.h"
#include "strtok.h"
#include "sendf.h"
#include "slist.h"
@@ -266,6 +265,22 @@ static const char *get_top_domain(const char * const
domain, size_t *outlen)
}
/*
+ * A case-insensitive hash for the cookie domains.
+ */
+static size_t cookie_hash_domain(const char *domain, const size_t len)
+{
+ const char *end = domain + len;
+ unsigned long h = 5381;
+
+ while(domain < end) {
+ h += h << 5;
+ h ^= (unsigned long) Curl_raw_toupper(*domain++);
+ }
+
+ return (h % COOKIE_HASH_SIZE);
+}
+
+/*
* Hash this domain.
*/
static size_t cookiehash(const char * const domain)
@@ -277,7 +292,7 @@ static size_t cookiehash(const char * const domain)
return 0;
top = get_top_domain(domain, &len);
- return Curl_hash_str((void *) top, len, COOKIE_HASH_SIZE);
+ return cookie_hash_domain(top, len);
}
/*
diff --git a/tests/data/test46 b/tests/data/test46
index a4bc9e4fa..fd0e666c6 100644
--- a/tests/data/test46
+++ b/tests/data/test46
@@ -74,6 +74,7 @@ Cookie: empty=; mooo2=indeed2; mooo=indeed
# https://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
+www.fake.come FALSE / FALSE 2022144953 cookiecliente si
domain..tld FALSE / FALSE 1739150993 mooo indeed
#HttpOnly_domain..tld FALSE /want FALSE 1739150993 mooo2 indeed2
domain..tld FALSE /want FALSE 0 empty
@@ -82,7 +83,6 @@ domain..tld FALSE / FALSE 0 ckySession
temporary
domain..tld FALSE / FALSE 0 ASPSESSIONIDQGGQQSJJ
GKNBDIFAAOFDPDAIEAKDIBKE
domain..tld FALSE / FALSE 0 justaname
domain..tld FALSE /want/ FALSE 0 simplyhuge
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
[...]
-www.fake.come FALSE / FALSE 2022144953 cookiecliente si
www.loser.com FALSE / FALSE 2139150993 UID 99
</file>
</verify>
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 35/178: openldap: fix for NULL return from ldap_get_attribute_ber(), (continued)
- [GNUnet-SVN] [gnurl] 35/178: openldap: fix for NULL return from ldap_get_attribute_ber(), gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 10/178: examples/hiperfifo.c: improved, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 14/178: CURLOPT_HAPROXYPROTOCOL: support the HAProxy PROXY protocol, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 12/178: multi: improved pending transfers handling => improved performance, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 39/178: travis: enable apt retry on fail, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 36/178: threaded resolver: track resolver time and set suitable timeout values, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 30/178: CI: add lgtm.yml for tweaking lgtm.com analysis, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 40/178: TODO: connection cache sharing is now supporte, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 43/178: test1148: set a fixed locale for the test, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 41/178: cmake: Add advapi32 as explicit link library for win32, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 49/178: cookie: case-insensitive hashing for the domains,
gnunet <=
- [GNUnet-SVN] [gnurl] 47/178: openssl: provide defines for argument typecasts to build warning-free, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 60/178: configure: detect sa_family_t, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 45/178: cookie: store cookies per top-level-domain-specific hash table, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 58/178: hash: calculate sizes with size_t instead of longs, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 53/178: FTP: allow PASV on IPv6 connections when a proxy is being used, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 42/178: docs: fix CURLINFO_*_T examples use of CURL_FORMAT_CURL_OFF_T, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 62/178: curl_setup: provide a CURL_SA_FAMILY_T type if none exists, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 59/178: tool_operate: Fix retry on FTP 4xx to ignore other protocols, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 61/178: build: add picky compiler warning flags for gcc 6 and 7, gnunet, 2018/05/23
- [GNUnet-SVN] [gnurl] 46/178: openssl: fix build with LibreSSL 2.7, gnunet, 2018/05/23