fixes bug 191715 "PAC: did not work, after a external site is shown" r=bbaetz sr=bz

This commit is contained in:
darin%netscape.com 2003-04-04 20:50:46 +00:00
parent 40b182063f
commit e601785fb3
2 changed files with 9 additions and 1 deletions

View File

@ -188,12 +188,13 @@ function dnsResolve(host) {
if (host == dnsResolveCachedHost) {
return dnsResolveCachedIp;
}
dnsResolveCachedHost = host;
try {
dnsResolveCachedIp = dns.resolve(host);
dnsResolveCachedHost = host;
}
catch (e) {
dnsResolveCachedIp = null;
dnsResolveCachedHost = null;
}
return dnsResolveCachedIp;
}

View File

@ -1720,6 +1720,13 @@ nsDNSService::Resolve(const char *i_hostname, char **o_ip)
if (index == 0) return NS_ERROR_FAILURE;
else {
// if netAddr is IPv4 mapped IPv6 address, then convert to IPv4 before
// serializing (see bug 191715).
if (PR_IsNetAddrType(&netAddr, PR_IpAddrV4Mapped)) {
PRUint32 v4addr = netAddr.ipv6.ip.pr_s6_addr32[3];
netAddr.inet.family = PR_AF_INET;
netAddr.inet.ip = v4addr;
}
PRStatus status = PR_NetAddrToString(&netAddr, ipBuffer, sizeof(ipBuffer));
if (status != PR_SUCCESS) return NS_ERROR_FAILURE;
}