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

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(
181 response_headers, 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 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 757
757 DCHECK(document_state); 758 DCHECK(document_state);
758 DCHECK(ds); 759 DCHECK(ds);
759 GURL url(ds->request().url()); 760 GURL url(ds->request().url());
760 Time start = document_state->start_load_time(); 761 Time start = document_state->start_load_time();
761 Time finish = document_state->finish_load_time(); 762 Time finish = document_state->finish_load_time();
762 // TODO(mbelshe): should we log more stats? 763 // TODO(mbelshe): should we log more stats?
763 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms " 764 VLOG(1) << "PLT: " << (finish - start).InMilliseconds() << "ms "
764 << url.spec(); 765 << url.spec();
765 } 766 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698