ASpdySession.cpp (1648B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set sw=2 ts=8 et tw=80 : */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 // HttpLog.h should generally be included first 8 #include "HttpLog.h" 9 10 /* 11 Currently supported is h2 12 */ 13 14 #include "nsHttp.h" 15 #include "nsHttpHandler.h" 16 17 #include "ASpdySession.h" 18 #include "Http2Session.h" 19 20 #include "mozilla/StaticPrefs_network.h" 21 22 namespace mozilla { 23 namespace net { 24 25 ASpdySession* ASpdySession::NewSpdySession(net::SpdyVersion version, 26 nsISocketTransport* aTransport, 27 bool attemptingEarlyData) { 28 // This is a necko only interface, so we can enforce version 29 // requests as a precondition 30 MOZ_ASSERT(version == SpdyVersion::HTTP_2, "Unsupported spdy version"); 31 32 // Don't do a runtime check of IsSpdyV?Enabled() here because pref value 33 // may have changed since starting negotiation. The selected protocol comes 34 // from a list provided in the SERVER HELLO filtered by our acceptable 35 // versions, so there is no risk of the server ignoring our prefs. 36 37 return Http2Session::CreateSession(aTransport, version, attemptingEarlyData); 38 } 39 40 SpdyInformation::SpdyInformation() { 41 // highest index of enabled protocols is the 42 // most preferred for ALPN negotiaton 43 Version = SpdyVersion::HTTP_2; 44 VersionString = "h2"_ns; 45 ALPNCallbacks = Http2Session::ALPNCallback; 46 } 47 48 } // namespace net 49 } // namespace mozilla