diff options
author | Cronet Mainline Eng <cronet-mainline-eng+copybara@google.com> | 2023-04-17 14:36:25 -0800 |
---|---|---|
committer | Patrick Rohr <prohr@google.com> | 2023-04-17 15:41:30 -0700 |
commit | 41cb724250484f326b0bbd5f8b955eb37b3b83c6 (patch) | |
tree | cb7b2cbe08b2c5305a56b31649359f8141edd198 /net/socket/transport_connect_job.cc | |
parent | c175721cfcc03e339122be17d569239df9762b2b (diff) | |
download | cronet-41cb724250484f326b0bbd5f8b955eb37b3b83c6.tar.gz |
Import Cronet version 114.0.5709.3
Project import generated by Copybara.
FolderOrigin-RevId: /tmp/copybara-origin/src
Test: none
Change-Id: I263aa6b692a17ac2471b98b6e662b26dd1327c9c
Diffstat (limited to 'net/socket/transport_connect_job.cc')
-rw-r--r-- | net/socket/transport_connect_job.cc | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/net/socket/transport_connect_job.cc b/net/socket/transport_connect_job.cc index 5d3fc5283..64bf8fa06 100644 --- a/net/socket/transport_connect_job.cc +++ b/net/socket/transport_connect_job.cc @@ -7,21 +7,21 @@ #include <memory> #include <utility> -#include "base/bind.h" #include "base/check_op.h" #include "base/feature_list.h" +#include "base/functional/bind.h" #include "base/location.h" #include "base/logging.h" #include "base/metrics/histogram_macros.h" #include "base/notreached.h" #include "base/task/single_thread_task_runner.h" #include "base/time/time.h" -#include "base/trace_event/trace_event.h" #include "net/base/features.h" #include "net/base/host_port_pair.h" #include "net/base/ip_endpoint.h" #include "net/base/net_errors.h" #include "net/base/trace_constants.h" +#include "net/base/tracing.h" #include "net/dns/public/host_resolver_results.h" #include "net/dns/public/secure_dns_policy.h" #include "net/log/net_log_event_type.h" @@ -511,25 +511,21 @@ bool TransportConnectJob::IsSvcbOptional( // If SVCB/HTTPS resolution succeeded, the client supports ECH, and all routes // support ECH, disable the A/AAAA fallback. See Section 10.1 of // draft-ietf-dnsop-svcb-https-08. + auto* scheme_host_port = absl::get_if<url::SchemeHostPort>(¶ms_->destination()); - if (!base::FeatureList::IsEnabled(features::kEncryptedClientHello) || - !scheme_host_port || scheme_host_port->scheme() != url::kHttpsScheme) { - return true; // ECH is not supported for this request. + if (!scheme_host_port || scheme_host_port->scheme() != url::kHttpsScheme) { + return true; // This is not a SVCB-capable request at all. } - bool has_svcb = false; - for (const auto& result : results) { - if (!result.metadata.supported_protocol_alpns.empty()) { - has_svcb = true; - if (result.metadata.ech_config_list.empty()) { - return true; // There is a non-ECH SVCB/HTTPS route. - } - } + if (!common_connect_job_params()->ssl_client_context || + !common_connect_job_params() + ->ssl_client_context->config() + .EncryptedClientHelloEnabled()) { + return true; // ECH is not supported for this request. } - // Either there were no SVCB/HTTPS records (should be SVCB-optional), or there - // were and all supported ECH (should be SVCB-reliant). - return !has_svcb; + + return !HostResolver::AllProtocolEndpointsHaveEch(results); } bool TransportConnectJob::IsEndpointResultUsable( |