зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1382886 - Add a callback when the handshake is done. r=necko-reviewers,kershaw,keeler
Differential Revision: https://phabricator.services.mozilla.com/D123601
This commit is contained in:
Родитель
96de623086
Коммит
c116b60b2c
|
@ -20,6 +20,7 @@ XPIDL_SOURCES += [
|
|||
"nsIHttpHeaderVisitor.idl",
|
||||
"nsIHttpProtocolHandler.idl",
|
||||
"nsIRaceCacheWithNetwork.idl",
|
||||
"nsITlsHandshakeListener.idl",
|
||||
"nsIWellKnownOpportunisticUtils.idl",
|
||||
]
|
||||
|
||||
|
|
|
@ -2368,6 +2368,7 @@ NS_INTERFACE_MAP_BEGIN(nsHttpConnection)
|
|||
NS_INTERFACE_MAP_ENTRY(nsIOutputStreamCallback)
|
||||
NS_INTERFACE_MAP_ENTRY(nsITransportEventSink)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
|
||||
NS_INTERFACE_MAP_ENTRY(nsITlsHandshakeCallbackListener)
|
||||
NS_INTERFACE_MAP_ENTRY(HttpConnectionBase)
|
||||
NS_INTERFACE_MAP_ENTRY_CONCRETE(nsHttpConnection)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
@ -2597,5 +2598,10 @@ bool nsHttpConnection::GetEchConfigUsed() {
|
|||
return val;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpConnection::HandshakeDone() {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsISupportsPriority.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsITlsHandshakeListener.h"
|
||||
|
||||
class nsISocketTransport;
|
||||
class nsISSLSocketControl;
|
||||
|
@ -56,6 +57,7 @@ class nsHttpConnection final : public HttpConnectionBase,
|
|||
public nsIOutputStreamCallback,
|
||||
public nsITransportEventSink,
|
||||
public nsIInterfaceRequestor,
|
||||
public nsITlsHandshakeCallbackListener,
|
||||
public NudgeTunnelCallback {
|
||||
private:
|
||||
virtual ~nsHttpConnection();
|
||||
|
@ -70,6 +72,7 @@ class nsHttpConnection final : public HttpConnectionBase,
|
|||
NS_DECL_NSIOUTPUTSTREAMCALLBACK
|
||||
NS_DECL_NSITRANSPORTEVENTSINK
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
NS_DECL_NSITLSHANDSHAKECALLBACKLISTENER
|
||||
NS_DECL_NUDGETUNNELCALLBACK
|
||||
|
||||
nsHttpConnection();
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[builtinclass, uuid(b4bbe824-ec4c-48be-9a40-6a7339347f40)]
|
||||
interface nsITlsHandshakeCallbackListener : nsISupports {
|
||||
[noscript] void handshakeDone();
|
||||
};
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
interface nsIInterfaceRequestor;
|
||||
interface nsIX509Cert;
|
||||
interface nsITlsHandshakeCallbackListener;
|
||||
|
||||
%{C++
|
||||
#include "nsStringFwd.h"
|
||||
|
@ -171,5 +172,6 @@ interface nsISSLSocketControl : nsISupports {
|
|||
* Disable early data.
|
||||
*/
|
||||
[noscript] void disableEarlyData();
|
||||
};
|
||||
|
||||
[noscript] void setHandshakeCallbackListener(in nsITlsHandshakeCallbackListener callback);
|
||||
};
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "ssl.h"
|
||||
#include "mozilla/net/SSLTokensCache.h"
|
||||
#include "nsICertOverrideService.h"
|
||||
#include "nsITlsHandshakeListener.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -355,5 +356,11 @@ CommonSocketControl::GetRetryEchConfig(nsACString& aEchConfig) {
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CommonSocketControl::SetHandshakeCallbackListener(
|
||||
nsITlsHandshakeCallbackListener* callback) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CommonSocketControl::DisableEarlyData(void) { return NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
|
|
@ -250,6 +250,10 @@ void nsNSSSocketInfo::SetHandshakeCompleted() {
|
|||
("[%p] nsNSSSocketInfo::SetHandshakeCompleted\n", (void*)mFd));
|
||||
|
||||
mIsFullHandshake = false; // reset for next handshake on this connection
|
||||
|
||||
if (mTlsHandshakeCallback) {
|
||||
Unused << mTlsHandshakeCallback->HandshakeDone();
|
||||
}
|
||||
}
|
||||
|
||||
void nsNSSSocketInfo::SetNegotiatedNPN(const char* value, uint32_t length) {
|
||||
|
@ -456,6 +460,13 @@ nsNSSSocketInfo::DisableEarlyData() {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNSSSocketInfo::SetHandshakeCallbackListener(
|
||||
nsITlsHandshakeCallbackListener* callback) {
|
||||
mTlsHandshakeCallback = callback;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsSSLIOLayerHelpers::Cleanup() {
|
||||
MutexAutoLock lock(mutex);
|
||||
mTLSIntoleranceInfo.Clear();
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "nsTHashMap.h"
|
||||
#include "nsIProxyInfo.h"
|
||||
#include "nsISSLSocketControl.h"
|
||||
#include "nsITlsHandshakeListener.h"
|
||||
#include "nsNSSCertificate.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "sslt.h"
|
||||
|
@ -73,6 +74,8 @@ class nsNSSSocketInfo final : public CommonSocketControl {
|
|||
NS_IMETHOD GetPeerId(nsACString& aResult) override;
|
||||
NS_IMETHOD GetRetryEchConfig(nsACString& aEchConfig) override;
|
||||
NS_IMETHOD DisableEarlyData(void) override;
|
||||
NS_IMETHOD SetHandshakeCallbackListener(
|
||||
nsITlsHandshakeCallbackListener* callback) override;
|
||||
|
||||
PRStatus CloseSocketAndDestroy();
|
||||
|
||||
|
@ -241,6 +244,8 @@ class nsNSSSocketInfo final : public CommonSocketControl {
|
|||
// rest of the session. This is normally used when you have per
|
||||
// socket tls flags overriding session wide defaults.
|
||||
RefPtr<mozilla::psm::SharedSSLState> mOwningSharedRef;
|
||||
|
||||
nsCOMPtr<nsITlsHandshakeCallbackListener> mTlsHandshakeCallback;
|
||||
};
|
||||
|
||||
// This class is used to store the needed information for invoking the client
|
||||
|
|
Загрузка…
Ссылка в новой задаче