mirror of
https://github.com/curl/curl.git
synced 2026-07-23 04:17:16 +03:00
create_hostcache_id: use the key lower cased
... to make sure the DNS cache is properly case insensitive
This commit is contained in:
parent
207cf15032
commit
81ebdd9e28
1 changed files with 12 additions and 3 deletions
15
lib/hostip.c
15
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.
|
* the DNS caching.
|
||||||
*/
|
*/
|
||||||
static char *
|
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 */
|
/* 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 {
|
struct hostcache_prune_data {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue