Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: chrome/renderer/page_load_histograms.cc

Issue 387353003: Modify data_reduction_proxy_header to support tamper detection logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@work
Patch Set: after sync Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/renderer/page_load_histograms.h" 5 #include "chrome/renderer/page_load_histograms.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 std::string via_header = 170 std::string via_header =
171 base::UTF16ToUTF8(frame->dataSource()->response().httpHeaderField("Via")); 171 base::UTF16ToUTF8(frame->dataSource()->response().httpHeaderField("Via"));
172 172
173 if (via_header.empty()) 173 if (via_header.empty())
174 return false; 174 return false;
175 std::string headers = "HTTP/1.1 200 OK\nVia: " + via_header + "\n\n"; 175 std::string headers = "HTTP/1.1 200 OK\nVia: " + via_header + "\n\n";
176 // Produce raw headers, expected by the |HttpResponseHeaders| constructor. 176 // Produce raw headers, expected by the |HttpResponseHeaders| constructor.
177 std::replace(headers.begin(), headers.end(), '\n', '\0'); 177 std::replace(headers.begin(), headers.end(), '\n', '\0');
178 scoped_refptr<net::HttpResponseHeaders> response_headers( 178 scoped_refptr<net::HttpResponseHeaders> response_headers(
179 new net::HttpResponseHeaders(headers)); 179 new net::HttpResponseHeaders(headers));
180 return data_reduction_proxy::HasDataReductionProxyViaHeader(response_headers); 180 return data_reduction_proxy::HasDataReductionProxyViaHeader(response_headers,
bolian 2014/07/28 22:59:18 new line before the first argument and put the two
xingx1 2014/07/29 00:47:40 Done.
181 NULL);
181 } 182 }
182 183
183 // Returns true if the provided URL is a referrer string that came from 184 // Returns true if the provided URL is a referrer string that came from
184 // a Google Web Search results page. This is a little non-deterministic 185 // a Google Web Search results page. This is a little non-deterministic
185 // because desktop and mobile websearch differ and sometimes just provide 186 // because desktop and mobile websearch differ and sometimes just provide
186 // http://www.google.com/ as the referrer. In the case of /url we can be sure 187 // http://www.google.com/ as the referrer. In the case of /url we can be sure
187 // that it came from websearch but we will be generous and allow for cases 188 // that it came from websearch but we will be generous and allow for cases
188 // where a non-Google URL was provided a bare Google URL as a referrer. 189 // where a non-Google URL was provided a bare Google URL as a referrer.
189 // The domain validation matches the code used by the prerenderer for similar 190 // The domain validation matches the code used by the prerenderer for similar
190 // purposes. 191 // purposes.
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 749
749 DCHECK(document_state); 750 DCHECK(document_state);
750 DCHECK(ds); 751 DCHECK(ds);
751 GURL url(ds->request().url()); 752 GURL url(ds->request().url());
752 Time start = document_state->start_load_time(); 753 Time start = document_state->start_load_time();
753 Time finish = document_state->finish_load_time(); 754 Time finish = document_state->finish_load_time();
754 // TODO(mbelshe): should we log more stats? 755 // TODO(mbelshe): should we log more stats?
755 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " 756 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms "
756 << url.spec(); 757 << url.spec();
757 } 758 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698