OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/data_reduction_proxy/browser/data_reduction_proxy_protocol.
h" | 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol.
h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" | 9 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" |
10 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" | 10 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 void OverrideResponseAsRedirect( | 102 void OverrideResponseAsRedirect( |
103 net::URLRequest* request, | 103 net::URLRequest* request, |
104 const net::HttpResponseHeaders* original_response_headers, | 104 const net::HttpResponseHeaders* original_response_headers, |
105 scoped_refptr<net::HttpResponseHeaders>* override_response_headers) { | 105 scoped_refptr<net::HttpResponseHeaders>* override_response_headers) { |
106 DCHECK(request); | 106 DCHECK(request); |
107 DCHECK(original_response_headers); | 107 DCHECK(original_response_headers); |
108 DCHECK(override_response_headers->get() == NULL); | 108 DCHECK(override_response_headers->get() == NULL); |
109 | 109 |
110 request->SetLoadFlags(request->load_flags() | | 110 request->SetLoadFlags(request->load_flags() | |
111 net::LOAD_DISABLE_CACHE | | 111 net::LOAD_DISABLE_CACHE | |
112 net::LOAD_BYPASS_PROXY); | 112 net::LOAD_BYPASS_PROXY); |
113 *override_response_headers = new net::HttpResponseHeaders( | 113 *override_response_headers = new net::HttpResponseHeaders( |
114 original_response_headers->raw_headers()); | 114 original_response_headers->raw_headers()); |
115 (*override_response_headers)->ReplaceStatusLine("HTTP/1.1 302 Found"); | 115 (*override_response_headers)->ReplaceStatusLine("HTTP/1.1 302 Found"); |
116 (*override_response_headers)->RemoveHeader("Location"); | 116 (*override_response_headers)->RemoveHeader("Location"); |
117 (*override_response_headers)->AddHeader("Location: " + | 117 (*override_response_headers)->AddHeader("Location: " + |
118 request->url().spec()); | 118 request->url().spec()); |
119 // TODO(bengr): Should we pop_back the request->url_chain? | 119 // TODO(bengr): Should we pop_back the request->url_chain? |
120 } | 120 } |
121 | 121 |
122 void MarkProxiesAsBadUntil( | 122 void MarkProxiesAsBadUntil( |
(...skipping 23 matching lines...) Expand all Loading... |
146 net::ProxyService* proxy_service = request->context()->proxy_service(); | 146 net::ProxyService* proxy_service = request->context()->proxy_service(); |
147 DCHECK(proxy_service); | 147 DCHECK(proxy_service); |
148 | 148 |
149 proxy_service->MarkProxiesAsBadUntil(proxy_info, | 149 proxy_service->MarkProxiesAsBadUntil(proxy_info, |
150 bypass_duration, | 150 bypass_duration, |
151 fallback, | 151 fallback, |
152 request->net_log()); | 152 request->net_log()); |
153 } | 153 } |
154 | 154 |
155 } // namespace data_reduction_proxy | 155 } // namespace data_reduction_proxy |
OLD | NEW |