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

Side by Side Diff: net/url_request/url_request_http_job.cc

Issue 2125253002: Advertise brotli for localhost requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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
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
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
OLDNEW
« 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