Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2463)

Unified Diff: net/spdy/spdy_http_utils.cc

Issue 9705046: Switch CreateSpdyHeadersFromHttpRequest to construct the correct headers based on the spdy protocol… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix raman's comments. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_http_utils.h ('k') | net/spdy/spdy_network_transaction_spdy3_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_http_utils.cc
diff --git a/net/spdy/spdy_http_utils.cc b/net/spdy/spdy_http_utils.cc
index a3b7e54a96e433b817ed59bfeb7d2b1c582ed052..5545d4d1aba644e5e8a702e8593f822949d02f55 100644
--- a/net/spdy/spdy_http_utils.cc
+++ b/net/spdy/spdy_http_utils.cc
@@ -78,6 +78,7 @@ bool SpdyHeadersToHttpResponse(const spdy::SpdyHeaderBlock& headers,
void CreateSpdyHeadersFromHttpRequest(const HttpRequestInfo& info,
const HttpRequestHeaders& request_headers,
spdy::SpdyHeaderBlock* headers,
+ int protocol_version,
bool direct) {
HttpRequestHeaders::Iterator it(request_headers);
@@ -98,14 +99,23 @@ void CreateSpdyHeadersFromHttpRequest(const HttpRequestInfo& info,
}
static const char kHttpProtocolVersion[] = "HTTP/1.1";
- (*headers)["version"] = kHttpProtocolVersion;
- (*headers)["method"] = info.method;
- (*headers)["host"] = GetHostAndOptionalPort(info.url);
- (*headers)["scheme"] = info.url.scheme();
- if (direct)
- (*headers)["url"] = HttpUtil::PathForRequest(info.url);
- else
- (*headers)["url"] = HttpUtil::SpecForRequest(info.url);
+ if (protocol_version < 3) {
+ (*headers)["version"] = kHttpProtocolVersion;
+ (*headers)["method"] = info.method;
+ (*headers)["host"] = GetHostAndOptionalPort(info.url);
+ (*headers)["scheme"] = info.url.scheme();
+ if (direct)
+ (*headers)["url"] = HttpUtil::PathForRequest(info.url);
+ else
+ (*headers)["url"] = HttpUtil::SpecForRequest(info.url);
+ } else {
+ (*headers)[":version"] = kHttpProtocolVersion;
+ (*headers)[":method"] = info.method;
+ (*headers)[":host"] = GetHostAndOptionalPort(info.url);
+ (*headers)[":scheme"] = info.url.scheme();
+ (*headers)[":path"] = HttpUtil::PathForRequest(info.url);
+ headers->erase("host"); // this is kinda insane, spdy 3 spec.
+ }
}
« no previous file with comments | « net/spdy/spdy_http_utils.h ('k') | net/spdy/spdy_network_transaction_spdy3_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698