]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
conncache: lowercase the hash key for better match
authorDaniel Stenberg <daniel@haxx.se>
Tue, 1 Jun 2021 06:28:29 +0000 (08:28 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 1 Jun 2021 15:55:35 +0000 (17:55 +0200)
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

lib/conncache.c

index 5453c00f33e5bd74b241ec3dfc0fe708e1a096d2..a3cbe9fefe5a122d3ce41b93981a9b0da571e2ee 100644 (file)
@@ -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.