| 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/core/browser/data_reduction_proxy_metr
ics.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_metr
ics.h" |
| 6 | 6 |
| 7 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig.h" | 7 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig.h" |
| 8 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs.h" | 8 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs.h" |
| 9 #include "net/base/load_flags.h" | 9 #include "net/base/load_flags.h" |
| 10 #include "net/http/http_response_headers.h" | 10 #include "net/http/http_response_headers.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 return UNKNOWN_TYPE; | 29 return UNKNOWN_TYPE; |
| 30 } | 30 } |
| 31 | 31 |
| 32 // Check if the request came through the Data Reduction Proxy before checking | 32 // Check if the request came through the Data Reduction Proxy before checking |
| 33 // if proxies are bypassed, to avoid misreporting cases where the Data | 33 // if proxies are bypassed, to avoid misreporting cases where the Data |
| 34 // Reduction Proxy was bypassed between the request being sent out and the | 34 // Reduction Proxy was bypassed between the request being sent out and the |
| 35 // response coming in. For 304 responses, check if the request was sent to the | 35 // response coming in. For 304 responses, check if the request was sent to the |
| 36 // Data Reduction Proxy, since 304s aren't required to have a Via header even | 36 // Data Reduction Proxy, since 304s aren't required to have a Via header even |
| 37 // if they came through the Data Reduction Proxy. | 37 // if they came through the Data Reduction Proxy. |
| 38 if (request.response_headers() && | 38 if (request.response_headers() && |
| 39 (HasDataReductionProxyViaHeader(request.response_headers(), nullptr) || | 39 (HasDataReductionProxyViaHeader(*request.response_headers(), nullptr) || |
| 40 (request.response_headers()->response_code() == net::HTTP_NOT_MODIFIED && | 40 (request.response_headers()->response_code() == net::HTTP_NOT_MODIFIED && |
| 41 config.WasDataReductionProxyUsed(&request, nullptr)))) { | 41 config.WasDataReductionProxyUsed(&request, nullptr)))) { |
| 42 return VIA_DATA_REDUCTION_PROXY; | 42 return VIA_DATA_REDUCTION_PROXY; |
| 43 } | 43 } |
| 44 | 44 |
| 45 base::TimeDelta bypass_delay; | 45 base::TimeDelta bypass_delay; |
| 46 if (config.AreDataReductionProxiesBypassed( | 46 if (config.AreDataReductionProxiesBypassed( |
| 47 request, data_reduction_proxy_config, &bypass_delay)) { | 47 request, data_reduction_proxy_config, &bypass_delay)) { |
| 48 if (bypass_delay > base::TimeDelta::FromSeconds(kLongBypassDelayInSeconds)) | 48 if (bypass_delay > base::TimeDelta::FromSeconds(kLongBypassDelayInSeconds)) |
| 49 return LONG_BYPASS; | 49 return LONG_BYPASS; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 60 !config.IsDataReductionProxy(request.proxy_server(), NULL)) || | 60 !config.IsDataReductionProxy(request.proxy_server(), NULL)) || |
| 61 config.IsBypassedByDataReductionProxyLocalRules( | 61 config.IsBypassedByDataReductionProxyLocalRules( |
| 62 request, data_reduction_proxy_config)) { | 62 request, data_reduction_proxy_config)) { |
| 63 return SHORT_BYPASS; | 63 return SHORT_BYPASS; |
| 64 } | 64 } |
| 65 | 65 |
| 66 return UNKNOWN_TYPE; | 66 return UNKNOWN_TYPE; |
| 67 } | 67 } |
| 68 | 68 |
| 69 } // namespace data_reduction_proxy | 69 } // namespace data_reduction_proxy |
| OLD | NEW |