diff options
author | Daniel Stenberg <daniel@haxx.se> | 2011-12-30 22:46:57 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2011-12-31 10:58:05 +0100 |
commit | 81ebdd9e2875356a38e0b45d8164408563ae7a9c (patch) | |
tree | f0c4cef6ed05732313e608dfcea9abc91b14a45b /lib/hostip.c | |
parent | 207cf15032a7e8eab71b2f4655fc5c21e5d3623d (diff) |
create_hostcache_id: use the key lower cased
... to make sure the DNS cache is properly case insensitive
Diffstat (limited to 'lib/hostip.c')
-rw-r--r-- | lib/hostip.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/hostip.c b/lib/hostip.c index 03c3bc981..0d737f406 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -201,14 +201,23 @@ Curl_printable_address(const Curl_addrinfo *ai, char *buf, size_t bufsize) } /* - * Return a hostcache id string for the providing host + port, to be used by + * Return a hostcache id string for the provided host + port, to be used by * the DNS caching. */ static char * -create_hostcache_id(const char *server, int port) +create_hostcache_id(const char *name, int port) { /* create and return the new allocated entry */ - return aprintf("%s:%d", server, port); + char *id = aprintf("%s:%d", name, port); + char *ptr = id; + if(ptr) { + /* lower case the name part */ + while(*ptr != ':') { + *ptr = (char)TOLOWER(*ptr); + ptr++; + } + } + return id; } struct hostcache_prune_data { |