summaryrefslogtreecommitdiff
path: root/chromium/url/gurl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/url/gurl.cc')
-rw-r--r--chromium/url/gurl.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/chromium/url/gurl.cc b/chromium/url/gurl.cc
index d2374df4f47..fb06480ed6e 100644
--- a/chromium/url/gurl.cc
+++ b/chromium/url/gurl.cc
@@ -396,14 +396,14 @@ std::string GURL::ExtractFileName() const {
return ComponentString(file_component);
}
-std::string GURL::PathForRequest() const {
+base::StringPiece GURL::PathForRequestPiece() const {
DCHECK(parsed_.path.len > 0)
<< "Canonical path for requests should be non-empty";
if (parsed_.ref.len >= 0) {
// Clip off the reference when it exists. The reference starts after the
// #-sign, so we have to subtract one to also remove it.
- return std::string(spec_, parsed_.path.begin,
- parsed_.ref.begin - parsed_.path.begin - 1);
+ return base::StringPiece(&spec_[parsed_.path.begin],
+ parsed_.ref.begin - parsed_.path.begin - 1);
}
// Compute the actual path length, rather than depending on the spec's
// terminator. If we're an inner_url, our spec continues on into our outer
@@ -412,7 +412,11 @@ std::string GURL::PathForRequest() const {
if (parsed_.query.is_valid())
path_len = parsed_.query.end() - parsed_.path.begin;
- return std::string(spec_, parsed_.path.begin, path_len);
+ return base::StringPiece(&spec_[parsed_.path.begin], path_len);
+}
+
+std::string GURL::PathForRequest() const {
+ return PathForRequestPiece().as_string();
}
std::string GURL::HostNoBrackets() const {