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

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: 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
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..1575df72063ebc735cf963a9b62e36075e73d207 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
ramant (doing other things) 2012/03/15 05:41:34 nit: this -> This. Period at the end of sentence (
Ryan Hamilton 2012/03/15 16:38:06 Done.
+ }
}

Powered by Google App Engine
This is Rietveld 408576698