Bug 1581637 - Part 3 - Add Http3 to nsHttpConnectionInfo. r=mayhemer
authorDragana Damjanovic <dd.mozilla@gmail.com>
Fri, 01 Nov 2019 14:55:54 +0000
changeset 500210 b4fdc4c7aa6666ca40c02bc92e53ff0c800ead0b
parent 500209 100e9706f5a3510b60d662971ae2c2059db8a0f3
child 500211 2fd4b5760b2b2cf41331c67cbcfec59d7888ce53
push id114164
push useraiakab@mozilla.com
push dateTue, 05 Nov 2019 10:06:15 +0000
treeherdermozilla-inbound@4d585c7edc76 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer
bugs1581637
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1581637 - Part 3 - Add Http3 to nsHttpConnectionInfo. r=mayhemer Differential Revision: https://phabricator.services.mozilla.com/D46648
netwerk/protocol/http/nsHttpConnectionInfo.cpp
netwerk/protocol/http/nsHttpConnectionInfo.h
--- a/netwerk/protocol/http/nsHttpConnectionInfo.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionInfo.cpp
@@ -39,73 +39,75 @@ static nsresult SHA256(const char* aPlai
 
 namespace mozilla {
 namespace net {
 
 nsHttpConnectionInfo::nsHttpConnectionInfo(
     const nsACString& originHost, int32_t originPort,
     const nsACString& npnToken, const nsACString& username,
     const nsACString& topWindowOrigin, nsProxyInfo* proxyInfo,
-    const OriginAttributes& originAttributes, bool endToEndSSL, bool isolated)
+    const OriginAttributes& originAttributes, bool endToEndSSL, bool isolated,
+    bool aIsHttp3)
     : mRoutedPort(443), mIsolated(isolated), mLessThanTls13(false) {
   Init(originHost, originPort, npnToken, username, topWindowOrigin, proxyInfo,
-       originAttributes, endToEndSSL);
+       originAttributes, endToEndSSL, aIsHttp3);
 }
 
 nsHttpConnectionInfo::nsHttpConnectionInfo(
     const nsACString& originHost, int32_t originPort,
     const nsACString& npnToken, const nsACString& username,
     const nsACString& topWindowOrigin, nsProxyInfo* proxyInfo,
-    const OriginAttributes& originAttributes, bool endToEndSSL)
+    const OriginAttributes& originAttributes, bool endToEndSSL, bool aIsHttp3)
     : nsHttpConnectionInfo(originHost, originPort, npnToken, username,
                            topWindowOrigin, proxyInfo, originAttributes,
-                           endToEndSSL, false) {}
+                           endToEndSSL, false, aIsHttp3) {}
 
 nsHttpConnectionInfo::nsHttpConnectionInfo(
     const nsACString& originHost, int32_t originPort,
     const nsACString& npnToken, const nsACString& username,
     const nsACString& topWindowOrigin, nsProxyInfo* proxyInfo,
     const OriginAttributes& originAttributes, const nsACString& routedHost,
-    int32_t routedPort, bool isolated)
+    int32_t routedPort, bool isolated, bool aIsHttp3)
     : mIsolated(isolated), mLessThanTls13(false) {
   mEndToEndSSL = true;  // so DefaultPort() works
   mRoutedPort = routedPort == -1 ? DefaultPort() : routedPort;
 
   if (!originHost.Equals(routedHost) || (originPort != routedPort)) {
     mRoutedHost = routedHost;
   }
   Init(originHost, originPort, npnToken, username, topWindowOrigin, proxyInfo,
-       originAttributes, true);
+       originAttributes, true, aIsHttp3);
 }
 
 nsHttpConnectionInfo::nsHttpConnectionInfo(
     const nsACString& originHost, int32_t originPort,
     const nsACString& npnToken, const nsACString& username,
     const nsACString& topWindowOrigin, nsProxyInfo* proxyInfo,
     const OriginAttributes& originAttributes, const nsACString& routedHost,
-    int32_t routedPort)
+    int32_t routedPort, bool aIsHttp3)
     : nsHttpConnectionInfo(originHost, originPort, npnToken, username,
                            topWindowOrigin, proxyInfo, originAttributes,
-                           routedHost, routedPort, false) {}
+                           routedHost, routedPort, false, aIsHttp3) {}
 
 void nsHttpConnectionInfo::Init(const nsACString& host, int32_t port,
                                 const nsACString& npnToken,
                                 const nsACString& username,
                                 const nsACString& topWindowOrigin,
                                 nsProxyInfo* proxyInfo,
                                 const OriginAttributes& originAttributes,
-                                bool e2eSSL) {
+                                bool e2eSSL, bool aIsHttp3) {
   LOG(("Init nsHttpConnectionInfo @%p\n", this));
 
   mUsername = username;
   mTopWindowOrigin = topWindowOrigin;
   mProxyInfo = proxyInfo;
   mEndToEndSSL = e2eSSL;
   mUsingConnect = false;
   mNPNToken = npnToken;
+  mIsHttp3 = aIsHttp3;
   mOriginAttributes = originAttributes;
   mTlsFlags = 0x0;
   mIsTrrServiceChannel = false;
   mTrrDisabled = false;
   mIPv4Disabled = false;
   mIPv6Disabled = false;
 
   mUsingHttpsProxy = (proxyInfo && proxyInfo->IsHTTPS());
@@ -301,22 +303,23 @@ void nsHttpConnectionInfo::SetOriginServ
   BuildHashKey();
 }
 
 already_AddRefed<nsHttpConnectionInfo> nsHttpConnectionInfo::Clone() const {
   RefPtr<nsHttpConnectionInfo> clone;
   if (mRoutedHost.IsEmpty()) {
     clone = new nsHttpConnectionInfo(
         mOrigin, mOriginPort, mNPNToken, mUsername, mTopWindowOrigin,
-        mProxyInfo, mOriginAttributes, mEndToEndSSL, mIsolated);
+        mProxyInfo, mOriginAttributes, mEndToEndSSL, mIsolated, mIsHttp3);
   } else {
     MOZ_ASSERT(mEndToEndSSL);
-    clone = new nsHttpConnectionInfo(
-        mOrigin, mOriginPort, mNPNToken, mUsername, mTopWindowOrigin,
-        mProxyInfo, mOriginAttributes, mRoutedHost, mRoutedPort, mIsolated);
+    clone = new nsHttpConnectionInfo(mOrigin, mOriginPort, mNPNToken, mUsername,
+                                     mTopWindowOrigin, mProxyInfo,
+                                     mOriginAttributes, mRoutedHost,
+                                     mRoutedPort, mIsolated, mIsHttp3);
   }
 
   // Make sure the anonymous, insecure-scheme, and private flags are transferred
   clone->SetAnonymous(GetAnonymous());
   clone->SetPrivate(GetPrivate());
   clone->SetInsecureScheme(GetInsecureScheme());
   clone->SetNoSpdy(GetNoSpdy());
   clone->SetBeConservative(GetBeConservative());
@@ -362,17 +365,17 @@ nsresult nsHttpConnectionInfo::CreateWil
   if (!mUsingHttpsProxy) {
     MOZ_ASSERT(false);
     return NS_ERROR_NOT_IMPLEMENTED;
   }
 
   RefPtr<nsHttpConnectionInfo> clone;
   clone = new nsHttpConnectionInfo(NS_LITERAL_CSTRING("*"), 0, mNPNToken,
                                    mUsername, mTopWindowOrigin, mProxyInfo,
-                                   mOriginAttributes, true);
+                                   mOriginAttributes, true, mIsHttp3);
   // Make sure the anonymous and private flags are transferred!
   clone->SetAnonymous(GetAnonymous());
   clone->SetPrivate(GetPrivate());
   clone.forget(outParam);
   return NS_OK;
 }
 
 void nsHttpConnectionInfo::SetTrrDisabled(bool aNoTrr) {
--- a/netwerk/protocol/http/nsHttpConnectionInfo.h
+++ b/netwerk/protocol/http/nsHttpConnectionInfo.h
@@ -36,27 +36,28 @@ extern LazyLogModule gHttpLog;
 
 class nsHttpConnectionInfo final : public ARefBase {
  public:
   nsHttpConnectionInfo(const nsACString& originHost, int32_t originPort,
                        const nsACString& npnToken, const nsACString& username,
                        const nsACString& topWindowOrigin,
                        nsProxyInfo* proxyInfo,
                        const OriginAttributes& originAttributes,
-                       bool endToEndSSL = false);
+                       bool endToEndSSL = false, bool aIsHttp3 = false);
 
   // this version must use TLS and you may supply separate
   // connection (aka routing) information than the authenticated
   // origin information
   nsHttpConnectionInfo(const nsACString& originHost, int32_t originPort,
                        const nsACString& npnToken, const nsACString& username,
                        const nsACString& topWindowOrigin,
                        nsProxyInfo* proxyInfo,
                        const OriginAttributes& originAttributes,
-                       const nsACString& routedHost, int32_t routedPort);
+                       const nsACString& routedHost, int32_t routedPort,
+                       bool aIsHttp3);
 
  private:
   virtual ~nsHttpConnectionInfo() {
     MOZ_LOG(gHttpLog, LogLevel::Debug,
             ("Destroying nsHttpConnectionInfo @%p\n", this));
   }
 
   void BuildHashKey();
@@ -188,36 +189,38 @@ class nsHttpConnectionInfo final : publi
   // Returns true when origin/proxy is an RFC1918 literal.
   bool HostIsLocalIPLiteral() const;
 
   bool GetLessThanTls13() const { return mLessThanTls13; }
   void SetLessThanTls13(bool aLessThanTls13) {
     mLessThanTls13 = aLessThanTls13;
   }
 
+  bool IsHttp3() const { return mIsHttp3; }
+
  private:
   // These constructor versions are intended to only be used from Clone().
   nsHttpConnectionInfo(const nsACString& originHost, int32_t originPort,
                        const nsACString& npnToken, const nsACString& username,
                        const nsACString& topWindowOrigin,
                        nsProxyInfo* proxyInfo,
                        const OriginAttributes& originAttributes,
-                       bool endToEndSSL, bool isolated);
+                       bool endToEndSSL, bool isolated, bool aIsHttp3);
   nsHttpConnectionInfo(const nsACString& originHost, int32_t originPort,
                        const nsACString& npnToken, const nsACString& username,
                        const nsACString& topWindowOrigin,
                        nsProxyInfo* proxyInfo,
                        const OriginAttributes& originAttributes,
                        const nsACString& routedHost, int32_t routedPort,
-                       bool isolated);
+                       bool isolated, bool aIsHttp3);
 
   void Init(const nsACString& host, int32_t port, const nsACString& npnToken,
             const nsACString& username, const nsACString& topWindowOrigin,
             nsProxyInfo* proxyInfo, const OriginAttributes& originAttributes,
-            bool EndToEndSSL);
+            bool EndToEndSSL, bool aIsHttp3);
   void SetOriginServer(const nsACString& host, int32_t port);
 
   nsCString mOrigin;
   int32_t mOriginPort;
   nsCString mRoutedHost;
   int32_t mRoutedPort;
 
   nsCString mHashKey;
@@ -236,16 +239,17 @@ class nsHttpConnectionInfo final : publi
   uint16_t mIsTrrServiceChannel : 1;
   uint16_t mTrrDisabled : 1;
   uint16_t mIPv4Disabled : 1;
   uint16_t mIPv6Disabled : 1;
 
   bool mLessThanTls13;  // This will be set to true if we negotiate less than
                         // tls1.3. If the tls version is till not know or it
                         // is 1.3 or greater the value will be false.
+  bool mIsHttp3;
 
   // for RefPtr
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(nsHttpConnectionInfo, override)
 };
 
 }  // namespace net
 }  // namespace mozilla