#include "net/http/http_request_headers.h"
#include <string_view>
#include <utility>
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "base/strings/escape.h"
#include "base/strings/strcat.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "net/base/url_util.h"
#include "net/http/http_log_util.h"
#include "net/http/http_util.h"
#include "net/log/net_log_capture_mode.h"
#include "net/log/net_log_values.h"
namespace net {
namespace {
bool SupportsStreamType(
const std::optional<base::flat_set<SourceStream::SourceType>>&
accepted_stream_types,
SourceStream::SourceType type) { … }
}
const char HttpRequestHeaders::kConnectMethod[] = …;
const char HttpRequestHeaders::kDeleteMethod[] = …;
const char HttpRequestHeaders::kGetMethod[] = …;
const char HttpRequestHeaders::kHeadMethod[] = …;
const char HttpRequestHeaders::kOptionsMethod[] = …;
const char HttpRequestHeaders::kPatchMethod[] = …;
const char HttpRequestHeaders::kPostMethod[] = …;
const char HttpRequestHeaders::kPutMethod[] = …;
const char HttpRequestHeaders::kTraceMethod[] = …;
const char HttpRequestHeaders::kTrackMethod[] = …;
const char HttpRequestHeaders::kAccept[] = …;
const char HttpRequestHeaders::kAcceptCharset[] = …;
const char HttpRequestHeaders::kAcceptEncoding[] = …;
const char HttpRequestHeaders::kAcceptLanguage[] = …;
const char HttpRequestHeaders::kAuthorization[] = …;
const char HttpRequestHeaders::kCacheControl[] = …;
const char HttpRequestHeaders::kConnection[] = …;
const char HttpRequestHeaders::kContentLength[] = …;
const char HttpRequestHeaders::kContentType[] = …;
const char HttpRequestHeaders::kCookie[] = …;
const char HttpRequestHeaders::kHost[] = …;
const char HttpRequestHeaders::kIfMatch[] = …;
const char HttpRequestHeaders::kIfModifiedSince[] = …;
const char HttpRequestHeaders::kIfNoneMatch[] = …;
const char HttpRequestHeaders::kIfRange[] = …;
const char HttpRequestHeaders::kIfUnmodifiedSince[] = …;
const char HttpRequestHeaders::kOrigin[] = …;
const char HttpRequestHeaders::kPragma[] = …;
const char HttpRequestHeaders::kPriority[] = …;
const char HttpRequestHeaders::kProxyAuthorization[] = …;
const char HttpRequestHeaders::kProxyConnection[] = …;
const char HttpRequestHeaders::kRange[] = …;
const char HttpRequestHeaders::kReferer[] = …;
const char HttpRequestHeaders::kSecFetchStorageAccess[] = …;
const char HttpRequestHeaders::kTransferEncoding[] = …;
const char HttpRequestHeaders::kUserAgent[] = …;
HttpRequestHeaders::HeaderKeyValuePair::HeaderKeyValuePair() = default;
HttpRequestHeaders::HeaderKeyValuePair::HeaderKeyValuePair(
std::string_view key,
std::string_view value)
: … { … }
HttpRequestHeaders::HeaderKeyValuePair::HeaderKeyValuePair(std::string_view key,
std::string&& value)
: … { … }
HttpRequestHeaders::Iterator::Iterator(const HttpRequestHeaders& headers)
: … { … }
HttpRequestHeaders::Iterator::~Iterator() = default;
bool HttpRequestHeaders::Iterator::GetNext() { … }
HttpRequestHeaders::HttpRequestHeaders() = default;
HttpRequestHeaders::HttpRequestHeaders(const HttpRequestHeaders& other) =
default;
HttpRequestHeaders::HttpRequestHeaders(HttpRequestHeaders&& other) = default;
HttpRequestHeaders::~HttpRequestHeaders() = default;
HttpRequestHeaders& HttpRequestHeaders::operator=(
const HttpRequestHeaders& other) = default;
HttpRequestHeaders& HttpRequestHeaders::operator=(HttpRequestHeaders&& other) =
default;
std::optional<std::string> HttpRequestHeaders::GetHeader(
std::string_view key) const { … }
void HttpRequestHeaders::Clear() { … }
void HttpRequestHeaders::SetHeader(std::string_view key,
std::string_view value) { … }
void HttpRequestHeaders::SetHeader(std::string_view key, std::string&& value) { … }
void HttpRequestHeaders::SetHeaderWithoutCheckForTesting(
std::string_view key,
std::string_view value) { … }
void HttpRequestHeaders::SetHeaderIfMissing(std::string_view key,
std::string_view value) { … }
void HttpRequestHeaders::RemoveHeader(std::string_view key) { … }
void HttpRequestHeaders::AddHeaderFromString(std::string_view header_line) { … }
void HttpRequestHeaders::AddHeadersFromString(std::string_view headers) { … }
void HttpRequestHeaders::MergeFrom(const HttpRequestHeaders& other) { … }
std::string HttpRequestHeaders::ToString() const { … }
base::Value::Dict HttpRequestHeaders::NetLogParams(
const std::string& request_line,
NetLogCaptureMode capture_mode) const { … }
void HttpRequestHeaders::SetAcceptEncodingIfMissing(
const GURL& url,
const std::optional<base::flat_set<SourceStream::SourceType>>&
accepted_stream_types,
bool enable_brotli,
bool enable_zstd) { … }
HttpRequestHeaders::HeaderVector::iterator HttpRequestHeaders::FindHeader(
std::string_view key) { … }
HttpRequestHeaders::HeaderVector::const_iterator HttpRequestHeaders::FindHeader(
std::string_view key) const { … }
void HttpRequestHeaders::SetHeaderInternal(std::string_view key,
std::string&& value) { … }
}