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

Side by Side Diff: components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc

Issue 903213003: Enable QUIC for proxies based on Finch config and command line switch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments, added more tests Created 5 years, 10 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
OLDNEW
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/common/data_reduction_proxy_param s.h" 5 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 12 matching lines...) Expand all
23 #include "net/proxy/proxy_service.h" 23 #include "net/proxy/proxy_service.h"
24 #include "net/url_request/url_request.h" 24 #include "net/url_request/url_request.h"
25 #include "net/url_request/url_request_context.h" 25 #include "net/url_request/url_request_context.h"
26 #include "url/url_constants.h" 26 #include "url/url_constants.h"
27 27
28 using base::FieldTrialList; 28 using base::FieldTrialList;
29 29
30 namespace { 30 namespace {
31 31
32 const char kEnabled[] = "Enabled"; 32 const char kEnabled[] = "Enabled";
33 const char kDefaultOrigin[] = "https://proxy.googlezip.net:443"; 33 const char kDefaultSpdyOrigin[] = "https://proxy.googlezip.net:443";
34 const char kDefaultQuicOrigin[] = "quic://proxy.googlezip.net:443";
34 const char kDevOrigin[] = "https://proxy-dev.googlezip.net:443"; 35 const char kDevOrigin[] = "https://proxy-dev.googlezip.net:443";
35 const char kDevFallbackOrigin[] = "proxy-dev.googlezip.net:80"; 36 const char kDevFallbackOrigin[] = "proxy-dev.googlezip.net:80";
36 const char kDefaultFallbackOrigin[] = "compress.googlezip.net:80"; 37 const char kDefaultFallbackOrigin[] = "compress.googlezip.net:80";
37 // This is for a proxy that supports HTTP CONNECT to tunnel SSL traffic. 38 // This is for a proxy that supports HTTP CONNECT to tunnel SSL traffic.
38 // The proxy listens on port 443, but uses the HTTP protocol to set up 39 // The proxy listens on port 443, but uses the HTTP protocol to set up
39 // the tunnel, not HTTPS. 40 // the tunnel, not HTTPS.
40 const char kDefaultSslOrigin[] = "ssl.googlezip.net:443"; 41 const char kDefaultSslOrigin[] = "ssl.googlezip.net:443";
41 const char kDefaultAltOrigin[] = "ssl.googlezip.net:80"; 42 const char kDefaultAltOrigin[] = "ssl.googlezip.net:80";
42 const char kDefaultAltFallbackOrigin[] = "ssl.googlezip.net:80"; 43 const char kDefaultAltFallbackOrigin[] = "ssl.googlezip.net:80";
43 const char kDefaultProbeUrl[] = "http://check.googlezip.net/connect"; 44 const char kDefaultProbeUrl[] = "http://check.googlezip.net/connect";
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 "DataReductionProxyRemoveMissingViaHeaderOtherBypass") == "Relaxed"; 92 "DataReductionProxyRemoveMissingViaHeaderOtherBypass") == "Relaxed";
92 } 93 }
93 94
94 // static 95 // static
95 bool DataReductionProxyParams::IsIncludedInAndroidOnePromoFieldTrial( 96 bool DataReductionProxyParams::IsIncludedInAndroidOnePromoFieldTrial(
96 const char* build_fingerprint) { 97 const char* build_fingerprint) {
97 base::StringPiece fingerprint(build_fingerprint); 98 base::StringPiece fingerprint(build_fingerprint);
98 return (fingerprint.find(kAndroidOneIdentifier) != std::string::npos); 99 return (fingerprint.find(kAndroidOneIdentifier) != std::string::npos);
99 } 100 }
100 101
102 // static
103 bool DataReductionProxyParams::IsIncludedInUseQUICFieldTrial() {
104 return FieldTrialList::FindFullName("DataReductionProxyUseQuic") == kEnabled;
105 }
106
107 void DataReductionProxyParams::EnableQUIC(bool quic_enabled_for_proxies) {
108 quic_enabled_for_proxies_ = quic_enabled_for_proxies;
109 if (command_line_origin_.empty() && IsIncludedInUseQUICFieldTrial() &&
110 quic_enabled_for_proxies_)
111 origin_ = net::ProxyServer::FromURI(kDefaultQuicOrigin,
Ryan Hamilton 2015/02/11 00:20:32 It's a bit confusing that there's a member named "
tbansal1 2015/02/11 01:25:26 If other reviewers feel strongly about it, I volun
112 net::ProxyServer::SCHEME_HTTP);
113 }
114
101 DataReductionProxyTypeInfo::DataReductionProxyTypeInfo() 115 DataReductionProxyTypeInfo::DataReductionProxyTypeInfo()
102 : proxy_servers(), 116 : proxy_servers(),
103 is_fallback(false), 117 is_fallback(false),
104 is_alternative(false), 118 is_alternative(false),
105 is_ssl(false) { 119 is_ssl(false) {
106 } 120 }
107 121
108 DataReductionProxyTypeInfo::~DataReductionProxyTypeInfo(){ 122 DataReductionProxyTypeInfo::~DataReductionProxyTypeInfo(){
109 } 123 }
110 124
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 299
286 std::string probe_url = command_line.GetSwitchValueASCII( 300 std::string probe_url = command_line.GetSwitchValueASCII(
287 switches::kDataReductionProxyProbeURL); 301 switches::kDataReductionProxyProbeURL);
288 std::string warmup_url = command_line.GetSwitchValueASCII( 302 std::string warmup_url = command_line.GetSwitchValueASCII(
289 switches::kDataReductionProxyWarmupURL); 303 switches::kDataReductionProxyWarmupURL);
290 304
291 // Set from preprocessor constants those params that are not specified on the 305 // Set from preprocessor constants those params that are not specified on the
292 // command line. 306 // command line.
293 if (origin.empty()) 307 if (origin.empty())
294 origin = GetDefaultDevOrigin(); 308 origin = GetDefaultDevOrigin();
309 command_line_origin_ = origin;
295 if (origin.empty()) 310 if (origin.empty())
296 origin = GetDefaultOrigin(); 311 origin = GetDefaultOrigin();
297 if (fallback_origin.empty()) 312 if (fallback_origin.empty())
298 fallback_origin = GetDefaultDevFallbackOrigin(); 313 fallback_origin = GetDefaultDevFallbackOrigin();
299 if (fallback_origin.empty()) 314 if (fallback_origin.empty())
300 fallback_origin = GetDefaultFallbackOrigin(); 315 fallback_origin = GetDefaultFallbackOrigin();
301 if (ssl_origin.empty()) 316 if (ssl_origin.empty())
302 ssl_origin = GetDefaultSSLOrigin(); 317 ssl_origin = GetDefaultSSLOrigin();
303 if (alt_origin.empty()) 318 if (alt_origin.empty())
304 alt_origin = GetDefaultAltOrigin(); 319 alt_origin = GetDefaultAltOrigin();
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 } 528 }
514 529
515 if (retry_delay) 530 if (retry_delay)
516 *retry_delay = found->second.current_delay; 531 *retry_delay = found->second.current_delay;
517 532
518 return true; 533 return true;
519 } 534 }
520 535
521 // TODO(kundaji): Remove tests for macro definitions. 536 // TODO(kundaji): Remove tests for macro definitions.
522 std::string DataReductionProxyParams::GetDefaultOrigin() const { 537 std::string DataReductionProxyParams::GetDefaultOrigin() const {
523 return kDefaultOrigin; 538 return IsIncludedInUseQUICFieldTrial() && quic_enabled_for_proxies_
539 ? kDefaultQuicOrigin
540 : kDefaultSpdyOrigin;
524 } 541 }
525 542
526 std::string DataReductionProxyParams::GetDefaultFallbackOrigin() const { 543 std::string DataReductionProxyParams::GetDefaultFallbackOrigin() const {
527 return kDefaultFallbackOrigin; 544 return kDefaultFallbackOrigin;
528 } 545 }
529 546
530 std::string DataReductionProxyParams::GetDefaultSSLOrigin() const { 547 std::string DataReductionProxyParams::GetDefaultSSLOrigin() const {
531 return kDefaultSslOrigin; 548 return kDefaultSslOrigin;
532 } 549 }
533 550
534 std::string DataReductionProxyParams::GetDefaultAltOrigin() const { 551 std::string DataReductionProxyParams::GetDefaultAltOrigin() const {
535 return kDefaultAltOrigin; 552 return kDefaultAltOrigin;
536 } 553 }
537 554
538 std::string DataReductionProxyParams::GetDefaultAltFallbackOrigin() const { 555 std::string DataReductionProxyParams::GetDefaultAltFallbackOrigin() const {
539 return kDefaultAltFallbackOrigin; 556 return kDefaultAltFallbackOrigin;
540 } 557 }
541 558
542 std::string DataReductionProxyParams::GetDefaultProbeURL() const { 559 std::string DataReductionProxyParams::GetDefaultProbeURL() const {
543 return kDefaultProbeUrl; 560 return kDefaultProbeUrl;
544 } 561 }
545 562
546 std::string DataReductionProxyParams::GetDefaultWarmupURL() const { 563 std::string DataReductionProxyParams::GetDefaultWarmupURL() const {
547 return kDefaultWarmupUrl; 564 return kDefaultWarmupUrl;
548 } 565 }
549 566
550 } // namespace data_reduction_proxy 567 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698