Bug 1094519 - Advertise h2-15 in addition to h2-14. r=mcmanus

This commit is contained in:
Nicholas Hurley 2014-11-10 21:17:00 +01:00
parent 8733cb18e1
commit 083547dbdc
5 changed files with 15 additions and 8 deletions

View File

@ -87,8 +87,12 @@ SpdyInformation::SpdyInformation()
ALPNCallbacks[2] = Http2Session::ALPNCallback;
Version[3] = NS_HTTP2_DRAFT_VERSION;
VersionString[3] = NS_LITERAL_CSTRING(NS_HTTP2_DRAFT_TOKEN);
VersionString[3] = NS_LITERAL_CSTRING("h2-14");
ALPNCallbacks[3] = Http2Session::ALPNCallback;
Version[4] = NS_HTTP2_DRAFT_VERSION;
VersionString[4] = NS_LITERAL_CSTRING(NS_HTTP2_DRAFT_TOKEN);
ALPNCallbacks[4] = Http2Session::ALPNCallback;
}
bool
@ -104,6 +108,7 @@ SpdyInformation::ProtocolEnabled(uint32_t index) const
case 2:
return gHttpHandler->IsHttp2Enabled();
case 3:
case 4:
return gHttpHandler->IsHttp2DraftEnabled();
}
return false;

View File

@ -74,7 +74,7 @@ public:
SpdyInformation();
~SpdyInformation() {}
static const uint32_t kCount = 4;
static const uint32_t kCount = 5;
// determine the index (0..kCount-1) of the spdy information that
// correlates to the npn string. NS_FAILED() if no match is found.

View File

@ -39,13 +39,15 @@ namespace net {
// 27 was http/2-draft09, h2-10, and h2-11
// 28 was http/2-draft12
// 29 was http/2-draft13
HTTP2_VERSION_DRAFT14 = 30
// 30 was also h2-14. They're effectively the same, -15 just adds one
// error code. So, we advertise both, but our "default position" is -15.
HTTP2_VERSION_DRAFT15 = 30
};
typedef uint8_t nsHttpVersion;
#define NS_HTTP2_DRAFT_VERSION HTTP2_VERSION_DRAFT14
#define NS_HTTP2_DRAFT_TOKEN "h2-14"
#define NS_HTTP2_DRAFT_VERSION HTTP2_VERSION_DRAFT15
#define NS_HTTP2_DRAFT_TOKEN "h2-15"
//-----------------------------------------------------------------------------
// http connection capabilities

View File

@ -25,7 +25,7 @@ var bigListenerMD5 = '8f607cfdd2c87d6a7eedb657dafbd836';
function checkIsHttp2(request) {
try {
if (request.getResponseHeader("X-Firefox-Spdy") == "h2-14") {
if (request.getResponseHeader("X-Firefox-Spdy") == "h2-15") {
if (request.getResponseHeader("X-Connection-Http2") == "yes") {
return true;
}
@ -378,7 +378,7 @@ var altsvcClientListener = {
function altsvcHttp1Server(metadata, response) {
response.setStatusLine(metadata.httpVersion, 200, "OK");
response.setHeader("Content-Type", "text/plain", false);
response.setHeader("Alt-Svc", 'h2=":6944"; ma=3200, h2-14=":6944"', false);
response.setHeader("Alt-Svc", 'h2=":6944"; ma=3200, h2-15=":6944"', false);
var body = "this is where a cool kid would write something neat.\n";
response.bodyOutputStream.write(body, body.length);
}

View File

@ -37,7 +37,7 @@
// [node-https]: http://nodejs.org/api/https.html
// [node-http]: http://nodejs.org/api/http.html
exports.VERSION = 'h2-14';
exports.VERSION = 'h2-15';
exports.Endpoint = require('./endpoint').Endpoint;