summaryrefslogtreecommitdiffstats
path: root/components/network_hints
diff options
context:
space:
mode:
authorgunsch <gunsch@chromium.org>2015-03-18 10:14:16 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-18 17:15:03 +0000
commit5922e15ca3d5c13d576e5d734c588852b509764d (patch)
tree10bbacbf2b3692425a3ce01b1cd5554f652dc3a1 /components/network_hints
parent5e0cae6ff3dbf9c4fde8631b08cc8170260e8e4d (diff)
downloadchromium_src-5922e15ca3d5c13d576e5d734c588852b509764d.zip
chromium_src-5922e15ca3d5c13d576e5d734c588852b509764d.tar.gz
chromium_src-5922e15ca3d5c13d576e5d734c588852b509764d.tar.bz2
DNS Prefetch fix: renderer shouldn't send long hostnames to browser.
R=ttuttle@chromium.org BUG=464270 Review URL: https://codereview.chromium.org/1007323003 Cr-Commit-Position: refs/heads/master@{#321154}
Diffstat (limited to 'components/network_hints')
-rw-r--r--components/network_hints/renderer/renderer_dns_prefetch.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/components/network_hints/renderer/renderer_dns_prefetch.cc b/components/network_hints/renderer/renderer_dns_prefetch.cc
index a9326b6..a1c38af 100644
--- a/components/network_hints/renderer/renderer_dns_prefetch.cc
+++ b/components/network_hints/renderer/renderer_dns_prefetch.cc
@@ -130,20 +130,23 @@ void RendererDnsPrefetch::ExtractBufferedNames(size_t size_goal) {
void RendererDnsPrefetch::DnsPrefetchNames(size_t max_count) {
// We are on the renderer thread, and just need to send things to the browser.
NameList names;
+ size_t domains_handled = 0;
for (DomainUseMap::iterator it = domain_map_.begin();
it != domain_map_.end();
++it) {
if (0 == (it->second & kLookupRequested)) {
it->second |= kLookupRequested;
- names.push_back(it->first);
+ domains_handled++;
+ if (it->first.length() <= network_hints::kMaxDnsHostnameLength)
+ names.push_back(it->first);
if (0 == max_count) continue; // Get all, independent of count.
if (1 == max_count) break;
--max_count;
DCHECK_GE(max_count, 1u);
}
}
- DCHECK_GE(new_name_count_, names.size());
- new_name_count_ -= names.size();
+ DCHECK_GE(new_name_count_, domains_handled);
+ new_name_count_ -= domains_handled;
network_hints::LookupRequest request;
request.hostname_list = names;