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

Unified Diff: net/spdy/spdy_http_utils.cc

Issue 1257623004: Send appropriate pseudo-headers in HTTP/2 CONNECT request. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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/http/http_network_transaction_unittest.cc ('k') | net/spdy/spdy_http_utils_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 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();
}
}
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/spdy/spdy_http_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698