| Index: net/http/transport_security_state.cc
|
| diff --git a/net/http/transport_security_state.cc b/net/http/transport_security_state.cc
|
| index d4d6f495199460c4af336f05ba4f5c5b3649a278..4ffe9e8796f8676689b0c01517b8a8ae08867f5e 100644
|
| --- a/net/http/transport_security_state.cc
|
| +++ b/net/http/transport_security_state.cc
|
| @@ -40,16 +40,22 @@ namespace net {
|
| namespace {
|
|
|
| #include "net/http/transport_security_state_ct_policies.inc"
|
| +
|
| +#if BUILDFLAG(INCLUDE_TRANSPORT_SECURITY_STATE_PRELOAD_LIST)
|
| #include "net/http/transport_security_state_static.h"
|
| +// Points to the active transport security state source.
|
| +const TransportSecurityStateSource* const kDefaultHSTSSource = &kHSTSSource;
|
| +#else
|
| +const TransportSecurityStateSource* const kDefaultHSTSSource = nullptr;
|
| +#endif
|
| +
|
| +const TransportSecurityStateSource* g_hsts_source = kDefaultHSTSSource;
|
|
|
| // Parameters for remembering sent HPKP and Expect-CT reports.
|
| const size_t kMaxReportCacheEntries = 50;
|
| const int kTimeToRememberReportsMins = 60;
|
| const size_t kReportCacheKeyLength = 16;
|
|
|
| -// Points to the active transport security state source.
|
| -const TransportSecurityStateSource* g_hsts_source = &kHSTSSource;
|
| -
|
| // Override for CheckCTRequirements() for unit tests. Possible values:
|
| // -1: Unless a delegate says otherwise, do not require CT.
|
| // 0: Use the default implementation (e.g. production)
|
| @@ -637,6 +643,11 @@ bool DecodeHSTSPreloadRaw(const std::string& search_hostname,
|
| }
|
|
|
| bool DecodeHSTSPreload(const std::string& hostname, PreloadResult* out) {
|
| +#if !BUILDFLAG(INCLUDE_TRANSPORT_SECURITY_STATE_PRELOAD_LIST)
|
| + if (g_hsts_source == nullptr)
|
| + return false;
|
| +#endif
|
| +
|
| bool found;
|
| if (!DecodeHSTSPreloadRaw(hostname, &found, out)) {
|
| DCHECK(false) << "Internal error in DecodeHSTSPreloadRaw for hostname "
|
| @@ -734,7 +745,7 @@ const base::Feature TransportSecurityState::kDynamicExpectCTFeature{
|
|
|
| void SetTransportSecurityStateSourceForTesting(
|
| const TransportSecurityStateSource* source) {
|
| - g_hsts_source = source ? source : &kHSTSSource;
|
| + g_hsts_source = source ? source : kDefaultHSTSSource;
|
| }
|
|
|
| TransportSecurityState::TransportSecurityState()
|
|
|