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

Unified Diff: content/browser/appcache/appcache_update_job.cc

Issue 695193002: AppCacheUpdateJob allows data reduction proxy bypass redirects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nit Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/appcache/appcache_update_job.cc
diff --git a/content/browser/appcache/appcache_update_job.cc b/content/browser/appcache/appcache_update_job.cc
index 088d939a6cef331338cc36536bf649f4ab7460e8..af47342e97c87d592d8278f06984dacb508a5bb2 100644
--- a/content/browser/appcache/appcache_update_job.cc
+++ b/content/browser/appcache/appcache_update_job.cc
@@ -12,6 +12,7 @@
#include "base/strings/stringprintf.h"
#include "content/browser/appcache/appcache_group.h"
#include "content/browser/appcache/appcache_histograms.h"
+#include "net/base/host_port_pair.h"
#include "net/base/io_buffer.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
@@ -20,6 +21,15 @@
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request_context.h"
+namespace {
+bool IsDataReductionProxy(const net::HostPortPair& proxy_server) {
+ return (
+ proxy_server.Equals(net::HostPortPair("proxy.googlezip.net", 443)) ||
+ proxy_server.Equals(net::HostPortPair("compress.googlezip.net", 80)) ||
+ proxy_server.Equals(net::HostPortPair("proxy-dev.googlezip.net", 80)));
+}
+} // namspace
+
namespace content {
static const int kBufferSize = 32768;
@@ -144,6 +154,16 @@ void AppCacheUpdateJob::URLFetcher::OnReceivedRedirect(
const net::RedirectInfo& redirect_info,
bool* defer_redirect) {
DCHECK(request_ == request);
+ // TODO(bengr): Remove this special case logic when crbug.com/429505 is
+ // resolved. Until then, the data reduction proxy client logic uses the
+ // redirect mechanism to resend requests over a direct connection when
+ // the proxy instructs it to do so. The redirect is to the same location
+ // as the original URL.
+ if ((request->load_flags() & net::LOAD_BYPASS_PROXY) &&
+ IsDataReductionProxy(request->proxy_server())) {
+ DCHECK_EQ(request->original_url(), request->url());
+ return;
+ }
// Redirect is not allowed by the update process.
job_->MadeProgress();
redirect_response_code_ = request->GetResponseCode();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698