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

Unified Diff: net/http/http_util_icu.cc

Issue 73633002: Add more test cases for HttpUtil::PathForRequest() and SpecForRequest() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | « no previous file | net/http/http_util_unittest.cc » ('j') | net/http/http_util_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_util_icu.cc
diff --git a/net/http/http_util_icu.cc b/net/http/http_util_icu.cc
index 4f38f84d75bac2bc52f005885f454a69ab5b1b2e..6f2af64efc96065ccfdc3cbd43ad7bfd08fe3e63 100644
--- a/net/http/http_util_icu.cc
+++ b/net/http/http_util_icu.cc
@@ -12,9 +12,14 @@
namespace net {
+static bool SchemeIsWebSocket(const GURL& url) {
+ return url.SchemeIs("ws") || url.SchemeIs("wss");
+}
+
// static
std::string HttpUtil::PathForRequest(const GURL& url) {
- DCHECK(url.is_valid() && url.SchemeIsHTTPOrHTTPS());
+ DCHECK(url.is_valid() && (url.SchemeIsHTTPOrHTTPS() ||
+ SchemeIsWebSocket(url)));
if (url.has_query())
return url.path() + "?" + url.query();
return url.path();
@@ -24,7 +29,8 @@ std::string HttpUtil::PathForRequest(const GURL& url) {
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")));
+ url.SchemeIs("ftp") ||
+ SchemeIsWebSocket(url)));
return SimplifyUrlForRequest(url).spec();
}
« no previous file with comments | « no previous file | net/http/http_util_unittest.cc » ('j') | net/http/http_util_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698