From 15ca033083155616460595d2e5c1c1f2fc441b58 Mon Sep 17 00:00:00 2001 From: Nicholas Hurley Date: Wed, 29 Jan 2014 13:42:19 -0800 Subject: [PATCH] Bug 959333 - HTTP/2 should say so in the status line. r=mcmanus --- netwerk/base/src/Dashboard.cpp | 3 +++ netwerk/protocol/http/Http2Compression.cpp | 2 +- netwerk/protocol/http/nsHttp.h | 1 + netwerk/protocol/http/nsHttpResponseHead.cpp | 8 ++++++-- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/netwerk/base/src/Dashboard.cpp b/netwerk/base/src/Dashboard.cpp index e9aa790bc57f..f88ce28f414a 100644 --- a/netwerk/base/src/Dashboard.cpp +++ b/netwerk/base/src/Dashboard.cpp @@ -501,6 +501,9 @@ HttpConnInfo::SetHTTP1ProtocolVersion(uint8_t pv) case NS_HTTP_VERSION_1_1: protocolVersion.Assign(NS_LITERAL_STRING("http/1.1")); break; + case NS_HTTP_VERSION_2_0: + protocolVersion.Assign(NS_LITERAL_STRING("http/2.0")); + break; default: protocolVersion.Assign(NS_LITERAL_STRING("unknown protocol version")); } diff --git a/netwerk/protocol/http/Http2Compression.cpp b/netwerk/protocol/http/Http2Compression.cpp index 08f5c9ede253..c4e66f9365b8 100644 --- a/netwerk/protocol/http/Http2Compression.cpp +++ b/netwerk/protocol/http/Http2Compression.cpp @@ -411,7 +411,7 @@ Http2Decompressor::OutputHeader(const nsACString &name, const nsACString &value) // Status comes first if (name.Equals(NS_LITERAL_CSTRING(":status"))) { - nsAutoCString status(NS_LITERAL_CSTRING("HTTP/1.1 ")); + nsAutoCString status(NS_LITERAL_CSTRING("HTTP/2.0 ")); status.Append(value); status.Append(NS_LITERAL_CSTRING("\r\n")); mOutput->Insert(status, 0); diff --git a/netwerk/protocol/http/nsHttp.h b/netwerk/protocol/http/nsHttp.h index e071fed55949..f13f2e228d24 100644 --- a/netwerk/protocol/http/nsHttp.h +++ b/netwerk/protocol/http/nsHttp.h @@ -17,6 +17,7 @@ #define NS_HTTP_VERSION_0_9 9 #define NS_HTTP_VERSION_1_0 10 #define NS_HTTP_VERSION_1_1 11 +#define NS_HTTP_VERSION_2_0 20 namespace mozilla { diff --git a/netwerk/protocol/http/nsHttpResponseHead.cpp b/netwerk/protocol/http/nsHttpResponseHead.cpp index cf6d70414044..fa81e4674314 100644 --- a/netwerk/protocol/http/nsHttpResponseHead.cpp +++ b/netwerk/protocol/http/nsHttpResponseHead.cpp @@ -55,7 +55,9 @@ nsHttpResponseHead::Flatten(nsACString &buf, bool pruneTransients) return; buf.AppendLiteral("HTTP/"); - if (mVersion == NS_HTTP_VERSION_1_1) + if (mVersion == NS_HTTP_VERSION_2_0) + buf.AppendLiteral("2.0 "); + else if (mVersion == NS_HTTP_VERSION_1_1) buf.AppendLiteral("1.1 "); else buf.AppendLiteral("1.0 "); @@ -766,7 +768,9 @@ nsHttpResponseHead::ParseVersion(const char *str) int major = atoi(str + 1); int minor = atoi(p); - if ((major > 1) || ((major == 1) && (minor >= 1))) + if ((major > 2) || ((major == 2) && (minor >= 0))) + mVersion = NS_HTTP_VERSION_2_0; + else if ((major == 1) && (minor >= 1)) // at least HTTP/1.1 mVersion = NS_HTTP_VERSION_1_1; else