| Index: net/spdy/spdy_http_utils.cc
|
| diff --git a/net/spdy/spdy_http_utils.cc b/net/spdy/spdy_http_utils.cc
|
| index 02543c0b3b15ed4460035ba5e1b583956e3f4127..c7dcb38362d64863479feb972e7fd35e86569e7e 100644
|
| --- a/net/spdy/spdy_http_utils.cc
|
| +++ b/net/spdy/spdy_http_utils.cc
|
| @@ -114,33 +114,43 @@ void CreateSpdyHeadersFromHttpRequest(const HttpRequestInfo& info,
|
| }
|
| static const char kHttpProtocolVersion[] = "HTTP/1.1";
|
|
|
| - if (protocol_version < SPDY3) {
|
| - // TODO(bcn): Remove this code now that SPDY/2 is deprecated.
|
| - (*headers)["version"] = kHttpProtocolVersion;
|
| - (*headers)["method"] = info.method;
|
| - (*headers)["host"] = GetHostAndOptionalPort(info.url);
|
| - if (info.method == "CONNECT") {
|
| - (*headers)["url"] = GetHostAndPort(info.url);
|
| - } else {
|
| - (*headers)["scheme"] = info.url.scheme();
|
| - (*headers)["url"] = direct ? info.url.PathForRequest()
|
| - : HttpUtil::SpecForRequest(info.url);
|
| - }
|
| - } else {
|
| - if (protocol_version < HTTP2) {
|
| + switch (protocol_version) {
|
| + case SPDY2:
|
| + // TODO(bnc): Remove this code now that SPDY/2 is deprecated.
|
| + (*headers)["version"] = kHttpProtocolVersion;
|
| + (*headers)["method"] = info.method;
|
| + (*headers)["host"] = GetHostAndOptionalPort(info.url);
|
| + if (info.method == "CONNECT") {
|
| + (*headers)["url"] = GetHostAndPort(info.url);
|
| + } else {
|
| + (*headers)["scheme"] = info.url.scheme();
|
| + (*headers)["url"] = direct ? info.url.PathForRequest()
|
| + : HttpUtil::SpecForRequest(info.url);
|
| + }
|
| + break;
|
| + case SPDY3:
|
| (*headers)[":version"] = kHttpProtocolVersion;
|
| (*headers)[":host"] = GetHostAndOptionalPort(info.url);
|
| - } else {
|
| - (*headers)[":authority"] = GetHostAndOptionalPort(info.url);
|
| - }
|
| - (*headers)[":method"] = info.method;
|
| - if (info.method == "CONNECT") {
|
| - // TODO(bnc): https://crbug.com/433784
|
| - (*headers)[":path"] = GetHostAndPort(info.url);
|
| - } else {
|
| - (*headers)[":scheme"] = info.url.scheme();
|
| - (*headers)[":path"] = info.url.PathForRequest();
|
| - }
|
| + (*headers)[":method"] = info.method;
|
| + if (info.method == "CONNECT") {
|
| + (*headers)[":path"] = GetHostAndPort(info.url);
|
| + } else {
|
| + (*headers)[":scheme"] = info.url.scheme();
|
| + (*headers)[":path"] = info.url.PathForRequest();
|
| + }
|
| + break;
|
| + case HTTP2:
|
| + (*headers)[":method"] = info.method;
|
| + if (info.method == "CONNECT") {
|
| + (*headers)[":authority"] = GetHostAndPort(info.url);
|
| + } else {
|
| + (*headers)[":authority"] = GetHostAndOptionalPort(info.url);
|
| + (*headers)[":scheme"] = info.url.scheme();
|
| + (*headers)[":path"] = info.url.PathForRequest();
|
| + }
|
| + break;
|
| + default:
|
| + NOTREACHED();
|
| }
|
| }
|
|
|
|
|