#include "net/http/http_auth_cache.h"
#include <list>
#include <map>
#include "base/logging.h"
#include "base/memory/raw_ref.h"
#include "base/metrics/histogram_macros.h"
#include "base/not_fatal_until.h"
#include "base/strings/string_util.h"
#include "url/gurl.h"
#include "url/scheme_host_port.h"
#include "url/url_constants.h"
namespace {
std::string GetParentDirectory(const std::string& path) { … }
bool IsEnclosingPath(const std::string& container, const std::string& path) { … }
#if DCHECK_IS_ON()
void CheckSchemeHostPortIsValid(const url::SchemeHostPort& scheme_host_port) { … }
void CheckPathIsValid(const std::string& path) { … }
#endif
struct IsEnclosedBy { … };
}
namespace net {
HttpAuthCache::HttpAuthCache(
bool key_server_entries_by_network_anonymization_key)
: … { … }
HttpAuthCache::~HttpAuthCache() = default;
void HttpAuthCache::SetKeyServerEntriesByNetworkAnonymizationKey(
bool key_server_entries_by_network_anonymization_key) { … }
HttpAuthCache::Entry* HttpAuthCache::Lookup(
const url::SchemeHostPort& scheme_host_port,
HttpAuth::Target target,
const std::string& realm,
HttpAuth::Scheme scheme,
const NetworkAnonymizationKey& network_anonymization_key) { … }
HttpAuthCache::Entry* HttpAuthCache::LookupByPath(
const url::SchemeHostPort& scheme_host_port,
HttpAuth::Target target,
const NetworkAnonymizationKey& network_anonymization_key,
const std::string& path) { … }
HttpAuthCache::Entry* HttpAuthCache::Add(
const url::SchemeHostPort& scheme_host_port,
HttpAuth::Target target,
const std::string& realm,
HttpAuth::Scheme scheme,
const NetworkAnonymizationKey& network_anonymization_key,
const std::string& auth_challenge,
const AuthCredentials& credentials,
const std::string& path) { … }
HttpAuthCache::Entry::Entry(const Entry& other) = default;
HttpAuthCache::Entry::~Entry() = default;
void HttpAuthCache::Entry::UpdateStaleChallenge(
const std::string& auth_challenge) { … }
bool HttpAuthCache::Entry::IsEqualForTesting(const Entry& other) const { … }
HttpAuthCache::Entry::Entry() = default;
void HttpAuthCache::Entry::AddPath(const std::string& path) { … }
bool HttpAuthCache::Entry::HasEnclosingPath(const std::string& dir,
size_t* path_len) { … }
bool HttpAuthCache::Remove(
const url::SchemeHostPort& scheme_host_port,
HttpAuth::Target target,
const std::string& realm,
HttpAuth::Scheme scheme,
const NetworkAnonymizationKey& network_anonymization_key,
const AuthCredentials& credentials) { … }
void HttpAuthCache::ClearEntriesAddedBetween(
base::Time begin_time,
base::Time end_time,
base::RepeatingCallback<bool(const GURL&)> url_matcher) { … }
void HttpAuthCache::ClearAllEntries() { … }
bool HttpAuthCache::UpdateStaleChallenge(
const url::SchemeHostPort& scheme_host_port,
HttpAuth::Target target,
const std::string& realm,
HttpAuth::Scheme scheme,
const NetworkAnonymizationKey& network_anonymization_key,
const std::string& auth_challenge) { … }
void HttpAuthCache::CopyProxyEntriesFrom(const HttpAuthCache& other) { … }
HttpAuthCache::EntryMapKey::EntryMapKey(
const url::SchemeHostPort& scheme_host_port,
HttpAuth::Target target,
const NetworkAnonymizationKey& network_anonymization_key,
bool key_server_entries_by_network_anonymization_key)
: … { … }
HttpAuthCache::EntryMapKey::~EntryMapKey() = default;
bool HttpAuthCache::EntryMapKey::operator<(const EntryMapKey& other) const { … }
size_t HttpAuthCache::GetEntriesSizeForTesting() { … }
HttpAuthCache::EntryMap::iterator HttpAuthCache::LookupEntryIt(
const url::SchemeHostPort& scheme_host_port,
HttpAuth::Target target,
const std::string& realm,
HttpAuth::Scheme scheme,
const NetworkAnonymizationKey& network_anonymization_key) { … }
void HttpAuthCache::EvictLeastRecentlyUsedEntry() { … }
}