summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornharper <nharper@chromium.org>2015-06-03 16:46:43 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-03 23:47:05 +0000
commit834c49bf1f8fdbcf879cbc20e607f43aa750cb51 (patch)
treea97ae3a9c2a7f9ebf99db0d18d597ceaa1b47043
parent5c13d76a088a244b93b3d05c76d0709d2d5a0be7 (diff)
downloadchromium_src-834c49bf1f8fdbcf879cbc20e607f43aa750cb51.zip
chromium_src-834c49bf1f8fdbcf879cbc20e607f43aa750cb51.tar.gz
chromium_src-834c49bf1f8fdbcf879cbc20e607f43aa750cb51.tar.bz2
Remove net::HttpUtil::PathForRequest
BUG=493698 Review URL: https://codereview.chromium.org/1149833014 Cr-Commit-Position: refs/heads/master@{#332734}
-rw-r--r--net/http/http_auth_handler_digest.cc2
-rw-r--r--net/http/http_basic_state.cc4
-rw-r--r--net/http/http_util.h4
-rw-r--r--net/http/http_util_icu.cc9
-rw-r--r--net/http/http_util_unittest.cc13
-rw-r--r--net/spdy/spdy_http_utils.cc4
6 files changed, 8 insertions, 28 deletions
diff --git a/net/http/http_auth_handler_digest.cc b/net/http/http_auth_handler_digest.cc
index 5c2e417..0fbd0d3 100644
--- a/net/http/http_auth_handler_digest.cc
+++ b/net/http/http_auth_handler_digest.cc
@@ -311,7 +311,7 @@ void HttpAuthHandlerDigest::GetRequestMethodAndPath(
*path = GetHostAndPort(url);
} else {
*method = request->method;
- *path = HttpUtil::PathForRequest(url);
+ *path = url.PathForRequest();
}
}
diff --git a/net/http/http_basic_state.cc b/net/http/http_basic_state.cc
index 2b173b0..060f2fe 100644
--- a/net/http/http_basic_state.cc
+++ b/net/http/http_basic_state.cc
@@ -50,8 +50,8 @@ std::string HttpBasicState::GenerateRequestLine() const {
const size_t kSuffixLen = arraysize(kSuffix) - 1;
DCHECK(request_info_);
const GURL& url = request_info_->url;
- const std::string path = using_proxy_ ? HttpUtil::SpecForRequest(url)
- : HttpUtil::PathForRequest(url);
+ const std::string path =
+ using_proxy_ ? HttpUtil::SpecForRequest(url) : url.PathForRequest();
// Don't use StringPrintf for concatenation because it is very inefficient.
std::string request_line;
const size_t expected_size = request_info_->method.size() + 1 + path.size() +
diff --git a/net/http/http_util.h b/net/http/http_util.h
index 211e634..b158524 100644
--- a/net/http/http_util.h
+++ b/net/http/http_util.h
@@ -24,10 +24,6 @@ namespace net {
class NET_EXPORT HttpUtil {
public:
- // Returns the absolute path of the URL, to be used for the http request.
- // The absolute path starts with a '/' and may contain a query.
- static std::string PathForRequest(const GURL& url);
-
// Returns the absolute URL, to be used for the http request. This url is
// made up of the protocol, host, [port], path, [query]. Everything else
// is stripped (username, password, reference).
diff --git a/net/http/http_util_icu.cc b/net/http/http_util_icu.cc
index 88ad590..9ee7e98 100644
--- a/net/http/http_util_icu.cc
+++ b/net/http/http_util_icu.cc
@@ -13,15 +13,6 @@
namespace net {
// static
-std::string HttpUtil::PathForRequest(const GURL& url) {
- DCHECK(url.is_valid() && (url.SchemeIsHTTPOrHTTPS() ||
- url.SchemeIsWSOrWSS()));
- if (url.has_query())
- return url.path() + "?" + url.query();
- return url.path();
-}
-
-// static
std::string HttpUtil::SpecForRequest(const GURL& url) {
// We may get ftp scheme when fetching ftp resources through proxy.
DCHECK(url.is_valid() && (url.SchemeIsHTTPOrHTTPS() || url.SchemeIs("ftp") ||
diff --git a/net/http/http_util_unittest.cc b/net/http/http_util_unittest.cc
index 3f4f625..7160284 100644
--- a/net/http/http_util_unittest.cc
+++ b/net/http/http_util_unittest.cc
@@ -591,51 +591,44 @@ TEST(HttpUtilTest, AssembleRawHeaders) {
}
}
-// Test SpecForRequest() and PathForRequest().
+// Test SpecForRequest().
TEST(HttpUtilTest, RequestUrlSanitize) {
struct {
const char* const url;
const char* const expected_spec;
- const char* const expected_path;
} tests[] = {
{ // Check that #hash is removed.
"http://www.google.com:78/foobar?query=1#hash",
"http://www.google.com:78/foobar?query=1",
- "/foobar?query=1"
},
{ // The reference may itself contain # -- strip all of it.
"http://192.168.0.1?query=1#hash#10#11#13#14",
"http://192.168.0.1/?query=1",
- "/?query=1"
},
{ // Strip username/password.
"http://user:pass@google.com",
"http://google.com/",
- "/"
},
{ // https scheme
"https://www.google.com:78/foobar?query=1#hash",
"https://www.google.com:78/foobar?query=1",
- "/foobar?query=1"
},
{ // WebSocket's ws scheme
"ws://www.google.com:78/foobar?query=1#hash",
"ws://www.google.com:78/foobar?query=1",
- "/foobar?query=1"
},
{ // WebSocket's wss scheme
"wss://www.google.com:78/foobar?query=1#hash",
"wss://www.google.com:78/foobar?query=1",
- "/foobar?query=1"
}
};
for (size_t i = 0; i < arraysize(tests); ++i) {
+ SCOPED_TRACE(i);
+
GURL url(GURL(tests[i].url));
std::string expected_spec(tests[i].expected_spec);
- std::string expected_path(tests[i].expected_path);
EXPECT_EQ(expected_spec, HttpUtil::SpecForRequest(url));
- EXPECT_EQ(expected_path, HttpUtil::PathForRequest(url));
}
}
diff --git a/net/spdy/spdy_http_utils.cc b/net/spdy/spdy_http_utils.cc
index b3f1983..5397473 100644
--- a/net/spdy/spdy_http_utils.cc
+++ b/net/spdy/spdy_http_utils.cc
@@ -123,7 +123,7 @@ void CreateSpdyHeadersFromHttpRequest(const HttpRequestInfo& info,
(*headers)["url"] = GetHostAndPort(info.url);
} else {
(*headers)["scheme"] = info.url.scheme();
- (*headers)["url"] = direct ? HttpUtil::PathForRequest(info.url)
+ (*headers)["url"] = direct ? info.url.PathForRequest()
: HttpUtil::SpecForRequest(info.url);
}
} else {
@@ -139,7 +139,7 @@ void CreateSpdyHeadersFromHttpRequest(const HttpRequestInfo& info,
(*headers)[":path"] = GetHostAndPort(info.url);
} else {
(*headers)[":scheme"] = info.url.scheme();
- (*headers)[":path"] = HttpUtil::PathForRequest(info.url);
+ (*headers)[":path"] = info.url.PathForRequest();
}
}
}