mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 857291 - fix 807678 regression of DNS::GetCanonicalName r=josh
This commit is contained in:
parent
e029597932
commit
afd013ce0b
@ -176,11 +176,19 @@ NetAddrElement::~NetAddrElement()
|
||||
}
|
||||
|
||||
AddrInfo::AddrInfo(const char *host, const PRAddrInfo *prAddrInfo,
|
||||
bool disableIPv4)
|
||||
bool disableIPv4, const char *cname)
|
||||
{
|
||||
size_t hostlen = strlen(host);
|
||||
mHostName = static_cast<char*>(moz_xmalloc(hostlen + 1));
|
||||
memcpy(mHostName, host, hostlen + 1);
|
||||
if (cname) {
|
||||
size_t cnameLen = strlen(cname);
|
||||
mCanonicalName = static_cast<char*>(moz_xmalloc(cnameLen + 1));
|
||||
memcpy(mCanonicalName, cname, cnameLen + 1);
|
||||
}
|
||||
else {
|
||||
mCanonicalName = nullptr;
|
||||
}
|
||||
|
||||
PRNetAddr tmpAddr;
|
||||
void *iter = nullptr;
|
||||
@ -200,6 +208,7 @@ AddrInfo::~AddrInfo()
|
||||
delete addrElement;
|
||||
}
|
||||
moz_free(mHostName);
|
||||
moz_free(mCanonicalName);
|
||||
}
|
||||
|
||||
} // namespace dns
|
||||
|
@ -121,10 +121,12 @@ public:
|
||||
|
||||
class AddrInfo {
|
||||
public:
|
||||
AddrInfo(const char *host, const PRAddrInfo *prAddrInfo, bool disableIPv4);
|
||||
AddrInfo(const char *host, const PRAddrInfo *prAddrInfo, bool disableIPv4,
|
||||
const char *cname);
|
||||
~AddrInfo();
|
||||
|
||||
char *mHostName;
|
||||
char *mCanonicalName;
|
||||
LinkedList<NetAddrElement> mAddresses;
|
||||
};
|
||||
|
||||
|
@ -83,7 +83,9 @@ nsDNSRecord::GetCanonicalName(nsACString &result)
|
||||
{
|
||||
MutexAutoLock lock(mHostRecord->addr_info_lock);
|
||||
if (mHostRecord->addr_info)
|
||||
cname = mHostRecord->addr_info->mHostName;
|
||||
cname = mHostRecord->addr_info->mCanonicalName ?
|
||||
mHostRecord->addr_info->mCanonicalName :
|
||||
mHostRecord->addr_info->mHostName;
|
||||
else
|
||||
cname = mHostRecord->host;
|
||||
result.Assign(cname);
|
||||
|
@ -997,7 +997,10 @@ nsHostResolver::ThreadFunc(void *arg)
|
||||
nsresult status;
|
||||
AddrInfo *ai = nullptr;
|
||||
if (prai) {
|
||||
ai = new AddrInfo(rec->host, prai, disableIPv4);
|
||||
const char *cname = nullptr;
|
||||
if (rec->flags & RES_CANON_NAME)
|
||||
cname = PR_GetCanonNameFromAddrInfo(prai);
|
||||
ai = new AddrInfo(rec->host, prai, disableIPv4, cname);
|
||||
PR_FreeAddrInfo(prai);
|
||||
if (ai->mAddresses.isEmpty()) {
|
||||
delete ai;
|
||||
|
Loading…
Reference in New Issue
Block a user