mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 01:35:35 +00:00
Bug 1525640 - Pass TRR status from sockettransport to channel r=dragana
Differential Revision: https://phabricator.services.mozilla.com/D26882 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
662c3bf371
commit
f172b45edc
@ -182,6 +182,10 @@ class FakeSocketTransportProvider : public nsISocketTransport {
|
||||
MOZ_ASSERT(false);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD ResolvedByTRR(bool *aResolvedByTRR) override {
|
||||
MOZ_ASSERT(false);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsITransport
|
||||
NS_IMETHOD OpenInputStream(uint32_t aFlags, uint32_t aSegmentSize,
|
||||
|
@ -314,4 +314,9 @@ interface nsISocketTransport : nsITransport
|
||||
* The value is set after PR_Connect is called.
|
||||
*/
|
||||
readonly attribute boolean esniUsed;
|
||||
|
||||
/**
|
||||
* IP address resolved using TRR.
|
||||
*/
|
||||
bool resolvedByTRR();
|
||||
};
|
||||
|
@ -708,6 +708,7 @@ nsSocketTransport::nsSocketTransport()
|
||||
mInputClosed(true),
|
||||
mOutputClosed(true),
|
||||
mResolving(false),
|
||||
mResolvedByTRR(false),
|
||||
mDNSLookupStatus(NS_OK),
|
||||
mDNSARequestFinished(0),
|
||||
mEsniQueried(false),
|
||||
@ -1803,6 +1804,7 @@ bool nsSocketTransport::RecoverFromError() {
|
||||
// try next ip address only if past the resolver stage...
|
||||
if (mState == STATE_CONNECTING && mDNSRecord) {
|
||||
nsresult rv = mDNSRecord->GetNextAddr(SocketPort(), &mNetAddr);
|
||||
mDNSRecord->IsTRR(&mResolvedByTRR);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
SOCKET_LOG((" trying again with next ip address\n"));
|
||||
tryAgain = true;
|
||||
@ -2096,6 +2098,7 @@ void nsSocketTransport::OnSocketEvent(uint32_t type, nsresult status,
|
||||
mDNSTxtRequest = nullptr;
|
||||
if (mDNSRecord) {
|
||||
mDNSRecord->GetNextAddr(SocketPort(), &mNetAddr);
|
||||
mDNSRecord->IsTRR(&mResolvedByTRR);
|
||||
}
|
||||
// status contains DNS lookup status
|
||||
if (NS_FAILED(status)) {
|
||||
@ -3523,5 +3526,11 @@ nsSocketTransport::GetEsniUsed(bool *aEsniUsed) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransport::ResolvedByTRR(bool *aResolvedByTRR) {
|
||||
*aResolvedByTRR = mResolvedByTRR;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
@ -328,6 +328,7 @@ class nsSocketTransport final : public nsASocketHandler,
|
||||
|
||||
nsCOMPtr<nsICancelable> mDNSRequest;
|
||||
nsCOMPtr<nsIDNSRecord> mDNSRecord;
|
||||
bool mResolvedByTRR;
|
||||
|
||||
nsresult mDNSLookupStatus;
|
||||
PRIntervalTime mDNSARequestFinished;
|
||||
|
@ -118,6 +118,7 @@ nsDNSRecord::IsTRR(bool *retval) {
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDNSRecord::GetNextAddr(uint16_t port, NetAddr *addr) {
|
||||
if (mDone) {
|
||||
|
@ -1827,6 +1827,14 @@ SocketTransportShim::GetEsniUsed(bool *aEsniUsed) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SocketTransportShim::ResolvedByTRR(bool *aResolvedByTRR) {
|
||||
if (mIsWebsocket) {
|
||||
LOG3(("WARNING: SocketTransportShim::IsTRR %p", this));
|
||||
}
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
#define FWD_TS_PTR(fx, ts) \
|
||||
NS_IMETHODIMP \
|
||||
SocketTransportShim::fx(ts *arg) { return mWrapped->fx(arg); }
|
||||
|
@ -8429,11 +8429,15 @@ nsHttpChannel::OnTransportStatus(nsITransport *trans, nsresult status,
|
||||
status == NS_NET_STATUS_WAITING_FOR) {
|
||||
if (mTransaction) {
|
||||
mTransaction->GetNetworkAddresses(mSelfAddr, mPeerAddr);
|
||||
mResolvedByTRR = mTransaction->ResolvedByTRR();
|
||||
} else {
|
||||
nsCOMPtr<nsISocketTransport> socketTransport = do_QueryInterface(trans);
|
||||
if (socketTransport) {
|
||||
socketTransport->GetSelfAddr(&mSelfAddr);
|
||||
socketTransport->GetPeerAddr(&mPeerAddr);
|
||||
bool isTrr = false;
|
||||
socketTransport->ResolvedByTRR(&isTrr);
|
||||
mResolvedByTRR = isTrr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -706,6 +706,10 @@ class nsHttpChannel final : public HttpBaseChannel,
|
||||
// Used to suspend any newly created pumps in mCallOnResume handler.
|
||||
uint32_t mAsyncResumePending : 1;
|
||||
|
||||
// If the request was performed to a TRR resolved IP address.
|
||||
// Will be false if loaded from the cache.
|
||||
uint32_t mResolvedByTRR : 1;
|
||||
|
||||
nsTArray<nsContinueRedirectionFunc> mRedirectFuncStack;
|
||||
|
||||
// Needed for accurate DNS timing
|
||||
|
@ -143,6 +143,7 @@ nsHttpTransaction::nsHttpTransaction()
|
||||
mPassedRatePacing(false),
|
||||
mSynchronousRatePaceRequest(false),
|
||||
mClassOfService(0),
|
||||
mResolvedByTRR(false),
|
||||
m0RTTInProgress(false),
|
||||
mDoNotTryEarlyData(false),
|
||||
mEarlyDataDisposition(EARLY_NONE),
|
||||
@ -591,6 +592,7 @@ void nsHttpTransaction::OnTransportStatus(nsITransport *transport,
|
||||
MutexAutoLock lock(mLock);
|
||||
socketTransport->GetSelfAddr(&mSelfAddr);
|
||||
socketTransport->GetPeerAddr(&mPeerAddr);
|
||||
socketTransport->ResolvedByTRR(&mResolvedByTRR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -464,10 +464,12 @@ class nsHttpTransaction final : public nsAHttpTransaction,
|
||||
|
||||
public:
|
||||
void GetNetworkAddresses(NetAddr &self, NetAddr &peer);
|
||||
bool ResolvedByTRR() { return mResolvedByTRR; }
|
||||
|
||||
private:
|
||||
NetAddr mSelfAddr;
|
||||
NetAddr mPeerAddr;
|
||||
bool mResolvedByTRR;
|
||||
|
||||
bool m0RTTInProgress;
|
||||
bool mDoNotTryEarlyData;
|
||||
|
Loading…
Reference in New Issue
Block a user