summaryrefslogtreecommitdiffstats
path: root/components/html_viewer
diff options
context:
space:
mode:
authorjam <jam@chromium.org>2015-05-05 22:02:53 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-06 05:03:25 +0000
commit3c8aea9e0c1dcf6cc7e625297432048e098de087 (patch)
tree2e636aaa8c366f50cd33d0019aa25cca3f118fd6 /components/html_viewer
parent83f29ef89702b5bf97da1e06f639e56817880b4d (diff)
downloadchromium_src-3c8aea9e0c1dcf6cc7e625297432048e098de087.zip
chromium_src-3c8aea9e0c1dcf6cc7e625297432048e098de087.tar.gz
chromium_src-3c8aea9e0c1dcf6cc7e625297432048e098de087.tar.bz2
Remove the referrer from URLLoader interface.
Instead it should be sent with the other headers. The current approach is a leak of the implementation details of src/net. Also switch the headers data structure to be a map for simplicity on caller's side, and also to avoid splitting the header lines right after combining them since we have to extract the referrer when creating the net::URLRequest. Review URL: https://codereview.chromium.org/1124013002 Cr-Commit-Position: refs/heads/master@{#328488}
Diffstat (limited to 'components/html_viewer')
-rw-r--r--components/html_viewer/blink_url_request_type_converters.cc13
-rw-r--r--components/html_viewer/web_url_loader_impl.cc3
2 files changed, 4 insertions, 12 deletions
diff --git a/components/html_viewer/blink_url_request_type_converters.cc b/components/html_viewer/blink_url_request_type_converters.cc
index 29fbbe69..29ea706 100644
--- a/components/html_viewer/blink_url_request_type_converters.cc
+++ b/components/html_viewer/blink_url_request_type_converters.cc
@@ -23,29 +23,24 @@ class HeaderFlattener : public blink::WebHTTPHeaderVisitor {
const std::string& name_latin1 = name.latin1();
const std::string& value_latin1 = value.latin1();
- // Skip over referrer headers found in the header map because we already
- // pulled it out as a separate parameter.
- if (LowerCaseEqualsASCII(name_latin1, "referer"))
- return;
-
if (LowerCaseEqualsASCII(name_latin1, "accept"))
has_accept_header_ = true;
- buffer_.push_back(name_latin1 + ": " + value_latin1);
+ buffer_[name_latin1] = value_latin1;
}
- Array<String> GetBuffer() {
+ Map<String, String> GetBuffer() {
// In some cases, WebKit doesn't add an Accept header, but not having the
// header confuses some web servers. See bug 808613.
if (!has_accept_header_) {
- buffer_.push_back("Accept: */*");
+ buffer_["Accept"] = "*/*";
has_accept_header_ = true;
}
return buffer_.Pass();
}
private:
- Array<String> buffer_;
+ Map<String, String> buffer_;
bool has_accept_header_;
};
diff --git a/components/html_viewer/web_url_loader_impl.cc b/components/html_viewer/web_url_loader_impl.cc
index f9bd9a2..4afd677 100644
--- a/components/html_viewer/web_url_loader_impl.cc
+++ b/components/html_viewer/web_url_loader_impl.cc
@@ -109,9 +109,6 @@ void WebURLLoaderImpl::loadAsynchronously(const blink::WebURLRequest& request,
mojo::URLRequestPtr url_request = mojo::URLRequest::From(request);
url_request->auto_follow_redirects = false;
referrer_policy_ = request.referrerPolicy();
- GURL referrer_url(
- request.httpHeaderField(WebString::fromUTF8("Referer")).latin1());
- url_request->referrer = referrer_url.spec();
if (request.extraData()) {
WebURLRequestExtraData* extra_data =