summaryrefslogtreecommitdiff
path: root/lib/conncache.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-06-01 08:28:29 +0200
committerDaniel Stenberg <daniel@haxx.se>2021-06-01 17:55:35 +0200
commitdddad339e8a56722babb5864b39a83f293f6491a (patch)
tree77745482be04df7ce3ccde071d19faaa743dfa65 /lib/conncache.c
parenta2b1bbeef0aa713e5e685efb63961600dff87622 (diff)
downloadcurl-dddad339e8a56722babb5864b39a83f293f6491a.tar.gz
conncache: lowercase the hash key for better match
As host names are case insensitive, the use of case sensitive hashing caused unnecesary cache misses and therefore lost performance. This lowercases the hash key. Reported-by: Harry Sintonen Fixes #7159 Closes #7161
Diffstat (limited to 'lib/conncache.c')
-rw-r--r--lib/conncache.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/conncache.c b/lib/conncache.c
index 5453c00f3..a3cbe9fef 100644
--- a/lib/conncache.c
+++ b/lib/conncache.c
@@ -34,6 +34,7 @@
#include "share.h"
#include "sigpipe.h"
#include "connect.h"
+#include "strcase.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
@@ -161,6 +162,7 @@ static void hashkey(struct connectdata *conn, char *buf,
/* put the number first so that the hostname gets cut off if too long */
msnprintf(buf, len, "%ld%s", port, hostname);
+ Curl_strntolower(buf, buf, len);
}
/* Returns number of connections currently held in the connection cache.