chromium/net/base/url_util.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/base/url_util.h"

#include "build/build_config.h"

#if BUILDFLAG(IS_POSIX)
#include <netinet/in.h>
#elif BUILDFLAG(IS_WIN)
#include <ws2tcpip.h>
#endif

#include <optional>
#include <string_view>

#include "base/check_op.h"
#include "base/containers/fixed_flat_set.h"
#include "base/strings/escape.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "net/base/ip_address.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "url/gurl.h"
#include "url/scheme_host_port.h"
#include "url/url_canon.h"
#include "url/url_canon_internal.h"
#include "url/url_canon_ip.h"
#include "url/url_constants.h"
#include "url/url_util.h"

namespace net {

namespace {

bool IsHostCharAlphanumeric(char c) {}

bool IsNormalizedLocalhostTLD(std::string_view host) {}

// Helper function used by GetIdentityFromURL. If |escaped_text| can be "safely
// unescaped" to a valid UTF-8 string, return that string, as UTF-16. Otherwise,
// convert it as-is to UTF-16. "Safely unescaped" is defined as having no
// escaped character between '0x00' and '0x1F', inclusive.
std::u16string UnescapeIdentityString(std::string_view escaped_text) {}

}  // namespace

GURL AppendQueryParameter(const GURL& url,
                          std::string_view name,
                          std::string_view value) {}

GURL AppendOrReplaceQueryParameter(const GURL& url,
                                   std::string_view name,
                                   std::optional<std::string_view> value) {}

GURL AppendOrReplaceRef(const GURL& url, const std::string_view& ref) {}

QueryIterator::QueryIterator(const GURL& url)
    :{}

QueryIterator::~QueryIterator() = default;

std::string_view QueryIterator::GetKey() const {}

std::string_view QueryIterator::GetValue() const {}

const std::string& QueryIterator::GetUnescapedValue() {}

bool QueryIterator::IsAtEnd() const {}

void QueryIterator::Advance() {}

bool GetValueForKeyInQuery(const GURL& url,
                           std::string_view search_key,
                           std::string* out_value) {}

bool ParseHostAndPort(std::string_view input, std::string* host, int* port) {}

std::string GetHostAndPort(const GURL& url) {}

std::string GetHostAndOptionalPort(const GURL& url) {}

NET_EXPORT std::string GetHostAndOptionalPort(
    const url::SchemeHostPort& scheme_host_port) {}

std::string TrimEndingDot(std::string_view host) {}

std::string GetHostOrSpecFromURL(const GURL& url) {}

std::string GetSuperdomain(std::string_view domain) {}

bool IsSubdomainOf(std::string_view subdomain, std::string_view superdomain) {}

std::string CanonicalizeHost(std::string_view host,
                             url::CanonHostInfo* host_info) {}

bool IsCanonicalizedHostCompliant(std::string_view host) {}

bool IsHostnameNonUnique(std::string_view hostname) {}

bool IsLocalhost(const GURL& url) {}

bool HostStringIsLocalhost(std::string_view host) {}

GURL SimplifyUrlForRequest(const GURL& url) {}

GURL ChangeWebSocketSchemeToHttpScheme(const GURL& url) {}

bool IsStandardSchemeWithNetworkHost(std::string_view scheme) {}

void GetIdentityFromURL(const GURL& url,
                        std::u16string* username,
                        std::u16string* password) {}

bool HasGoogleHost(const GURL& url) {}

bool IsGoogleHost(std::string_view host) {}

bool IsGoogleHostWithAlpnH3(std::string_view host) {}

bool IsLocalHostname(std::string_view host) {}

std::string UnescapePercentEncodedUrl(std::string_view input) {}

}  // namespace net