mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-30 19:17:31 +09:00
[network] Verify connection NPN against negotiated NPN.
This commit is contained in:
parent
d63a56adac
commit
024ab86be6
1 changed files with 15 additions and 1 deletions
|
|
@ -323,7 +323,8 @@ nsHttpConnection::StartSpdy(uint8_t spdyVersion)
|
||||||
if (!mTLSFilter) {
|
if (!mTLSFilter) {
|
||||||
mTransaction = mSpdySession;
|
mTransaction = mSpdySession;
|
||||||
} else {
|
} else {
|
||||||
mTLSFilter->SetProxiedTransaction(mSpdySession);
|
rv = mTLSFilter->SetProxiedTransaction(mSpdySession);
|
||||||
|
NS_ENSURE_SUCCESS_VOID(rv);
|
||||||
}
|
}
|
||||||
if (mDontReuse) {
|
if (mDontReuse) {
|
||||||
mSpdySession->DontReuse();
|
mSpdySession->DontReuse();
|
||||||
|
|
@ -355,6 +356,7 @@ nsHttpConnection::EnsureNPNComplete(nsresult &aOut0RTTWriteHandshakeValue,
|
||||||
nsCOMPtr<nsISupports> securityInfo;
|
nsCOMPtr<nsISupports> securityInfo;
|
||||||
nsCOMPtr<nsISSLSocketControl> ssl;
|
nsCOMPtr<nsISSLSocketControl> ssl;
|
||||||
nsAutoCString negotiatedNPN;
|
nsAutoCString negotiatedNPN;
|
||||||
|
nsAutoCString transactionNPN;
|
||||||
|
|
||||||
GetSecurityInfo(getter_AddRefs(securityInfo));
|
GetSecurityInfo(getter_AddRefs(securityInfo));
|
||||||
if (!securityInfo) {
|
if (!securityInfo) {
|
||||||
|
|
@ -373,6 +375,18 @@ nsHttpConnection::EnsureNPNComplete(nsresult &aOut0RTTWriteHandshakeValue,
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = ssl->GetNegotiatedNPN(negotiatedNPN);
|
rv = ssl->GetNegotiatedNPN(negotiatedNPN);
|
||||||
|
|
||||||
|
// Check if the connection NPN matches negotiated NPN.
|
||||||
|
transactionNPN = mConnInfo->GetNPNToken();
|
||||||
|
LOG(("negotiatedNPN: %s - transactionNPN: %s", negotiatedNPN.get(),
|
||||||
|
transactionNPN.get()));
|
||||||
|
if (!transactionNPN.IsEmpty() && negotiatedNPN != transactionNPN) {
|
||||||
|
LOG(("Resetting connection due to mismatched NPN token"));
|
||||||
|
DontReuse();
|
||||||
|
mTransaction->Close(NS_ERROR_NET_RESET);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!m0RTTChecked && (rv == NS_ERROR_NOT_CONNECTED) &&
|
if (!m0RTTChecked && (rv == NS_ERROR_NOT_CONNECTED) &&
|
||||||
!mConnInfo->UsingProxy()) {
|
!mConnInfo->UsingProxy()) {
|
||||||
// There is no ALPN info (yet!). We need to consider doing 0RTT. We
|
// There is no ALPN info (yet!). We need to consider doing 0RTT. We
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue