#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "base/check.h"
#include "base/cpu_reduction_experiment.h"
#include "url/url_canon.h"
#include "url/url_canon_internal.h"
#include "url/url_features.h"
namespace url {
namespace {
const unsigned char kEsc = …;
const unsigned char kHostCharLookup[0x80] = …;
const uint8_t kForbiddenHost = …;
const uint8_t kHostCharacterTable[128] = …;
bool IsForbiddenHostCodePoint(uint8_t ch) { … }
constexpr size_t kMaxHostLength = …;
constexpr size_t kMaxHostBufferLength = …;
constexpr size_t kTempHostBufferLen = …;
StackBuffer;
StackBufferW;
template<typename CHAR, typename UCHAR>
void ScanHostname(const CHAR* spec,
const Component& host,
bool* has_non_ascii,
bool* has_escaped) { … }
template <typename INCHAR, typename OUTCHAR>
bool DoSimpleHost(const INCHAR* host,
size_t host_len,
CanonOutputT<OUTCHAR>* output,
bool* has_non_ascii) { … }
bool DoIDNHost(const char16_t* src, size_t src_len, CanonOutput* output) { … }
bool DoComplexHost(const char* host,
size_t host_len,
bool has_non_ascii,
bool has_escaped,
CanonOutput* output) { … }
bool DoComplexHost(const char16_t* host,
size_t host_len,
bool has_non_ascii,
bool has_escaped,
CanonOutput* output) { … }
template <typename CHAR, typename UCHAR>
bool DoHostSubstring(const CHAR* spec,
const Component& host,
CanonOutput* output) { … }
template <typename CharT>
bool DoOpaqueHost(const std::basic_string_view<CharT> host,
CanonOutput& output) { … }
template <typename CHAR, typename UCHAR, CanonMode canon_mode>
void DoHost(const CHAR* spec,
const Component& host,
CanonOutput& output,
CanonHostInfo& host_info) { … }
}
bool CanonicalizeHost(const char* spec,
const Component& host,
CanonOutput* output,
Component* out_host) { … }
bool CanonicalizeHost(const char16_t* spec,
const Component& host,
CanonOutput* output,
Component* out_host) { … }
bool CanonicalizeSpecialHost(const char* spec,
const Component& host,
CanonOutput& output,
Component& out_host) { … }
bool CanonicalizeSpecialHost(const char16_t* spec,
const Component& host,
CanonOutput& output,
Component& out_host) { … }
bool CanonicalizeNonSpecialHost(const char* spec,
const Component& host,
CanonOutput& output,
Component& out_host) { … }
bool CanonicalizeNonSpecialHost(const char16_t* spec,
const Component& host,
CanonOutput& output,
Component& out_host) { … }
void CanonicalizeHostVerbose(const char* spec,
const Component& host,
CanonOutput* output,
CanonHostInfo* host_info) { … }
void CanonicalizeHostVerbose(const char16_t* spec,
const Component& host,
CanonOutput* output,
CanonHostInfo* host_info) { … }
void CanonicalizeSpecialHostVerbose(const char* spec,
const Component& host,
CanonOutput& output,
CanonHostInfo& host_info) { … }
void CanonicalizeSpecialHostVerbose(const char16_t* spec,
const Component& host,
CanonOutput& output,
CanonHostInfo& host_info) { … }
bool CanonicalizeHostSubstring(const char* spec,
const Component& host,
CanonOutput* output) { … }
bool CanonicalizeHostSubstring(const char16_t* spec,
const Component& host,
CanonOutput* output) { … }
void CanonicalizeNonSpecialHostVerbose(const char* spec,
const Component& host,
CanonOutput& output,
CanonHostInfo& host_info) { … }
void CanonicalizeNonSpecialHostVerbose(const char16_t* spec,
const Component& host,
CanonOutput& output,
CanonHostInfo& host_info) { … }
}