Bug 1107267 - Advertise h2-16. r=mcmanus

This commit is contained in:
Nicholas Hurley 2014-12-04 11:50:38 -08:00
Родитель 5c17989f7d
Коммит f42d623474
5 изменённых файлов: 15 добавлений и 10 удалений

Просмотреть файл

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

Просмотреть файл

@ -74,7 +74,7 @@ public:
SpdyInformation(); SpdyInformation();
~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 // determine the index (0..kCount-1) of the spdy information that
// correlates to the npn string. NS_FAILED() if no match is found. // correlates to the npn string. NS_FAILED() if no match is found.

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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