OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // The rules for parsing content-types were borrowed from Firefox: | 5 // The rules for parsing content-types were borrowed from Firefox: |
6 // http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834 | 6 // http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834 |
7 | 7 |
8 #include "net/http/http_util.h" | 8 #include "net/http/http_util.h" |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 | |
12 #include "net/base/net_util.h" | 11 #include "net/base/net_util.h" |
13 | 12 |
14 namespace net { | 13 namespace net { |
15 | 14 |
16 // static | 15 // static |
17 std::string HttpUtil::PathForRequest(const GURL& url) { | 16 std::string HttpUtil::PathForRequest(const GURL& url) { |
18 DCHECK(url.is_valid() && (url.SchemeIs("http") || url.SchemeIs("https"))); | 17 DCHECK(url.is_valid() && (url.SchemeIs("http") || url.SchemeIs("https"))); |
19 if (url.has_query()) | 18 if (url.has_query()) |
20 return url.path() + "?" + url.query(); | 19 return url.path() + "?" + url.query(); |
21 return url.path(); | 20 return url.path(); |
22 } | 21 } |
23 | 22 |
24 // static | 23 // static |
25 std::string HttpUtil::SpecForRequest(const GURL& url) { | 24 std::string HttpUtil::SpecForRequest(const GURL& url) { |
26 DCHECK(url.is_valid() && (url.SchemeIs("http") || url.SchemeIs("https"))); | 25 DCHECK(url.is_valid() && (url.SchemeIs("http") || url.SchemeIs("https"))); |
27 return SimplifyUrlForRequest(url).spec(); | 26 return SimplifyUrlForRequest(url).spec(); |
28 } | 27 } |
29 | 28 |
30 } // namespace net | 29 } // namespace net |
OLD | NEW |