mirror of
https://github.com/curl/curl.git
synced 2026-08-05 04:56:12 +03:00
peer: fix ipv6 detection
When trying to detect ipv6 addresses, ipv4 addresses were also flagged as ipv6. Add test2413 to check. Closes #22134
This commit is contained in:
parent
d824266425
commit
be1d976a2a
5 changed files with 141 additions and 2 deletions
|
|
@ -222,7 +222,14 @@ static CURLcode peer_parse_host(struct Curl_easy *data,
|
|||
if(scan_for_ipv6 &&
|
||||
Curl_looks_like_ipv6(pp->host_user.str, pp->host_user.len, TRUE,
|
||||
&pp->host, &pp->zoneid)) {
|
||||
pp->ipv6 = TRUE;
|
||||
if(pp->host_user.len < MAX_IPADR_LEN) {
|
||||
char tmp[MAX_IPADR_LEN];
|
||||
memcpy(tmp, pp->host_user.str, pp->host_user.len);
|
||||
tmp[pp->host_user.len] = 0;
|
||||
pp->ipv6 = !Curl_is_ipv4addr(tmp);
|
||||
}
|
||||
else
|
||||
pp->ipv6 = TRUE;
|
||||
}
|
||||
else
|
||||
pp->host = pp->host_user;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue