Index: content/browser/webui/url_data_manager_backend.cc |
diff --git a/content/browser/webui/url_data_manager_backend.cc b/content/browser/webui/url_data_manager_backend.cc |
index ba1f5d4646e05e7298698d9320121da7aa85489b..1cab8ae6aff41c69f79d678ab6668cafacc787ea 100644 |
--- a/content/browser/webui/url_data_manager_backend.cc |
+++ b/content/browser/webui/url_data_manager_backend.cc |
@@ -82,14 +82,18 @@ bool CheckURLIsValid(const GURL& url) { |
// Parse |url| to get the path which will be used to resolve the request. The |
// path is the remaining portion after the scheme and hostname. |
-void URLToRequestPath(const GURL& url, std::string* path) { |
+std::string URLToRequestPath(const GURL& url) { |
Charlie Reis
2015/07/16 19:25:03
Why can't we just use GURL::path()? This seems to
raymes
2015/07/17 01:58:29
I don't know the answer to that, I didn't write th
Charlie Reis
2015/07/17 23:45:22
Wow, this goes back to the initial commit:
https:/
raymes
2015/07/20 06:46:22
I no longer change this file in the latest patchse
|
const std::string& spec = url.possibly_invalid_spec(); |
const url::Parsed& parsed = url.parsed_for_possibly_invalid_spec(); |
// + 1 to skip the slash at the beginning of the path. |
int offset = parsed.CountCharactersBefore(url::Parsed::PATH, false) + 1; |
+ std::string path; |
if (offset < static_cast<int>(spec.size())) |
- path->assign(spec.substr(offset)); |
+ path = spec.substr(offset); |
+ |
+ // Remove the query string if there is one. |
+ return path.substr(0, path.find_last_of('?')); |
} |
// Returns a value of 'Origin:' header for the |request| if the header is set. |
@@ -585,8 +589,7 @@ bool URLDataManagerBackend::StartRequest(const net::URLRequest* request, |
if (!source->source()->ShouldServiceRequest(request)) |
return false; |
- std::string path; |
- URLToRequestPath(request->url(), &path); |
+ std::string path = URLToRequestPath(request->url()); |
source->source()->WillServiceRequest(request, &path); |
// Save this request so we know where to send the data. |