| OLD | NEW |
| 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 "net/url_request/url_request_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 sdch_test_control_ = true; // 1% probability. | 709 sdch_test_control_ = true; // 1% probability. |
| 710 dictionaries_advertised_.reset(); | 710 dictionaries_advertised_.reset(); |
| 711 advertise_sdch = false; | 711 advertise_sdch = false; |
| 712 } else { | 712 } else { |
| 713 sdch_test_activated_ = true; | 713 sdch_test_activated_ = true; |
| 714 } | 714 } |
| 715 } | 715 } |
| 716 | 716 |
| 717 // Advertise "br" encoding only if transferred data is opaque to proxy. | 717 // Advertise "br" encoding only if transferred data is opaque to proxy. |
| 718 bool advertise_brotli = false; | 718 bool advertise_brotli = false; |
| 719 if (request()->context()->enable_brotli()) | 719 if (request()->context()->enable_brotli()) { |
| 720 advertise_brotli = request()->url().SchemeIsCryptographic(); | 720 if (request()->url().SchemeIsCryptographic() || |
| 721 IsLocalhost(request()->url().HostNoBrackets())) { |
| 722 advertise_brotli = true; |
| 723 } |
| 724 } |
| 721 | 725 |
| 722 // Supply Accept-Encoding headers first so that it is more likely that they | 726 // Supply Accept-Encoding headers first so that it is more likely that they |
| 723 // will be in the first transmitted packet. This can sometimes make it | 727 // will be in the first transmitted packet. This can sometimes make it |
| 724 // easier to filter and analyze the streams to assure that a proxy has not | 728 // easier to filter and analyze the streams to assure that a proxy has not |
| 725 // damaged these headers. Some proxies deliberately corrupt Accept-Encoding | 729 // damaged these headers. Some proxies deliberately corrupt Accept-Encoding |
| 726 // headers. | 730 // headers. |
| 727 std::string advertised_encodings = "gzip, deflate"; | 731 std::string advertised_encodings = "gzip, deflate"; |
| 728 if (advertise_sdch) | 732 if (advertise_sdch) |
| 729 advertised_encodings += ", sdch"; | 733 advertised_encodings += ", sdch"; |
| 730 if (advertise_brotli) | 734 if (advertise_brotli) |
| (...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1678 // Notify NetworkQualityEstimator. | 1682 // Notify NetworkQualityEstimator. |
| 1679 if (request()) { | 1683 if (request()) { |
| 1680 NetworkQualityEstimator* network_quality_estimator = | 1684 NetworkQualityEstimator* network_quality_estimator = |
| 1681 request()->context()->network_quality_estimator(); | 1685 request()->context()->network_quality_estimator(); |
| 1682 if (network_quality_estimator) | 1686 if (network_quality_estimator) |
| 1683 network_quality_estimator->NotifyURLRequestDestroyed(*request()); | 1687 network_quality_estimator->NotifyURLRequestDestroyed(*request()); |
| 1684 } | 1688 } |
| 1685 } | 1689 } |
| 1686 | 1690 |
| 1687 } // namespace net | 1691 } // namespace net |
| OLD | NEW |