1#ifndef SOURCEMETA_CORE_HTTP_H_
2#define SOURCEMETA_CORE_HTTP_H_
4#ifndef SOURCEMETA_CORE_HTTP_EXPORT
5#include <sourcemeta/core/http_export.h>
9#include <sourcemeta/core/http_aws_sigv4.h>
10#include <sourcemeta/core/http_baggage.h>
11#include <sourcemeta/core/http_error.h>
12#include <sourcemeta/core/http_message.h>
13#include <sourcemeta/core/http_method.h>
14#include <sourcemeta/core/http_problem.h>
15#include <sourcemeta/core/http_status.h>
16#include <sourcemeta/core/http_syntax.h>
17#include <sourcemeta/core/http_system.h>
18#include <sourcemeta/core/http_tracecontext.h>
24#include <initializer_list>
51namespace sourcemeta::core {
76SOURCEMETA_CORE_HTTP_EXPORT
78 std::initializer_list<std::string_view> candidates)
95SOURCEMETA_CORE_HTTP_EXPORT
97 const std::string_view accept_header,
98 std::initializer_list<std::string_view> media_types)
noexcept -> bool;
113SOURCEMETA_CORE_HTTP_EXPORT
115 const std::string_view media_type)
noexcept
152SOURCEMETA_CORE_HTTP_EXPORT
154 -> std::optional<HTTPMediaType>;
177SOURCEMETA_CORE_HTTP_EXPORT
179 std::span<const std::string_view> ranges)
noexcept
198SOURCEMETA_CORE_HTTP_EXPORT
200 const std::string_view accept_language_header,
201 std::initializer_list<std::string_view> candidates) -> std::string_view;
216SOURCEMETA_CORE_HTTP_EXPORT
218 const std::string_view accept_encoding_header,
220 -> std::optional<HTTPContentEncoding>;
236SOURCEMETA_CORE_HTTP_EXPORT
238 -> std::optional<std::chrono::system_clock::time_point>;
256SOURCEMETA_CORE_HTTP_EXPORT
258 -> std::optional<std::chrono::seconds>;
270 std::span<const std::pair<std::string_view, std::string_view>>
parameters{};
286SOURCEMETA_CORE_HTTP_EXPORT
301SOURCEMETA_CORE_HTTP_EXPORT
321SOURCEMETA_CORE_HTTP_EXPORT
339SOURCEMETA_CORE_HTTP_EXPORT
367 std::optional<std::chrono::seconds>
max_age{};
403SOURCEMETA_CORE_HTTP_EXPORT
429SOURCEMETA_CORE_HTTP_EXPORT
431 std::string &out) -> bool;
445SOURCEMETA_CORE_HTTP_EXPORT
447 -> std::optional<std::string>;
462 std::span<const std::pair<std::string_view, std::string_view>>
parameters{};
489SOURCEMETA_CORE_HTTP_EXPORT
518SOURCEMETA_CORE_HTTP_EXPORT
525SOURCEMETA_CORE_HTTP_EXPORT
527 -> std::optional<std::string>;
534SOURCEMETA_CORE_HTTP_EXPORT
536 std::string &out) -> bool;
557SOURCEMETA_CORE_HTTP_EXPORT
559 -> std::optional<std::string>;
604SOURCEMETA_CORE_HTTP_EXPORT
606 std::vector<HTTPParsedChallenge> &challenges)
632 std::optional<std::string_view>
path{};
634 std::optional<std::string_view>
domain{};
636 std::optional<std::chrono::seconds>
max_age{};
678SOURCEMETA_CORE_HTTP_EXPORT
697SOURCEMETA_CORE_HTTP_EXPORT
712SOURCEMETA_CORE_HTTP_EXPORT
714 -> std::optional<std::string>;
732SOURCEMETA_CORE_HTTP_EXPORT
748SOURCEMETA_CORE_HTTP_EXPORT
750 const std::string_view header_value,
751 std::initializer_list<std::string_view> tokens)
noexcept -> bool;
777SOURCEMETA_CORE_HTTP_EXPORT
779 std::string &out) -> bool;
798SOURCEMETA_CORE_HTTP_EXPORT
800 -> std::optional<std::string>;
816SOURCEMETA_CORE_HTTP_EXPORT
std::string_view rel
The link relation type.
Definition http.h:268
std::vector< std::pair< std::string, std::string > > parameters
The authentication parameters, in the order they appeared.
Definition http.h:572
std::optional< std::string_view > token68
The credential the challenge carries in place of parameters.
Definition http.h:460
bool no_store
Whether no cache may store any part of the exchange (RFC 9111 §5.2.2.5).
Definition http.h:372
std::span< const std::string_view > private_fields
Definition http.h:390
bool proxy_revalidate
The same for a shared cache alone (RFC 9111 §5.2.2.8).
Definition http.h:380
bool secure
Whether the cookie is only sent over secure channels.
Definition http.h:640
std::optional< std::chrono::seconds > max_age
The cookie lifetime.
Definition http.h:636
std::span< const std::string_view > no_cache_fields
Definition http.h:393
std::string_view parameters
The parameters that follow the type, starting at the first ;.
Definition http.h:131
bool http_only
Whether the cookie is withheld from scripts.
Definition http.h:638
std::optional< std::string > token68
The credential the challenge carried in place of parameters.
Definition http.h:570
std::optional< std::string_view > domain
The host the cookie is scoped to.
Definition http.h:634
bool no_cache
Definition http.h:375
std::string scheme
The authentication scheme, as spelled in the field.
Definition http.h:568
std::optional< std::chrono::seconds > max_age
How long the response stays fresh (RFC 9111 §5.2.2.1).
Definition http.h:367
std::string_view name
The cookie name.
Definition http.h:628
bool must_revalidate
Definition http.h:378
std::span< const std::pair< std::string_view, std::string_view > > parameters
The authentication parameters.
Definition http.h:462
bool immutable
Whether the response will not be updated while fresh (RFC 8246).
Definition http.h:387
std::span< const std::pair< std::string_view, std::string_view > > parameters
The additional target attributes of the link.
Definition http.h:270
std::optional< HTTPCacheVisibility > visibility
Which caches may store the response.
Definition http.h:365
std::optional< HTTPCookieSameSite > same_site
The cross-site request policy for the cookie.
Definition http.h:642
std::string_view subtype
The subtype, such as geo+json.
Definition http.h:125
std::optional< std::chrono::seconds > shared_max_age
Definition http.h:370
bool must_understand
Definition http.h:383
std::optional< std::string_view > path
The path the cookie is scoped to.
Definition http.h:632
std::string_view target
The link target reference.
Definition http.h:266
std::string_view type
The type, such as application.
Definition http.h:123
std::string_view value
The cookie value.
Definition http.h:630
bool no_transform
Whether the payload must not be transformed (RFC 9111 §5.2.2.6).
Definition http.h:385
std::string_view suffix
Definition http.h:129
std::string_view scheme
The authentication scheme.
Definition http.h:458
HTTPCacheVisibility
Definition http.h:346
SOURCEMETA_CORE_HTTP_EXPORT auto http_match_accept_language(const std::string_view accept_language_header, std::initializer_list< std::string_view > candidates) -> std::string_view
SOURCEMETA_CORE_HTTP_EXPORT auto http_field_list_contains_any(const std::string_view header_value, std::initializer_list< std::string_view > tokens) noexcept -> bool
HTTPCookieSameSite
Definition http.h:611
SOURCEMETA_CORE_HTTP_EXPORT auto http_cache_control_valid(const HTTPCacheControl &directives) -> bool
SOURCEMETA_CORE_HTTP_EXPORT auto http_parse_media_type(const std::string_view media_type) -> std::optional< HTTPMediaType >
SOURCEMETA_CORE_HTTP_EXPORT auto http_parse_bearer(const std::string_view authorization) noexcept -> std::string_view
SOURCEMETA_CORE_HTTP_EXPORT auto http_serialize_challenge(const HTTPChallenge &challenge, std::string &out) -> bool
SOURCEMETA_CORE_HTTP_EXPORT auto http_match_accept(const std::string_view accept_header, std::initializer_list< std::string_view > candidates) -> std::string_view
SOURCEMETA_CORE_HTTP_EXPORT auto http_serialize_cookie(const HTTPCookie &cookie, std::string &out) -> bool
constexpr std::size_t HTTP_COOKIE_MAXIMUM_ATTRIBUTE_VALUE_LENGTH
Definition http.h:657
constexpr std::size_t HTTP_COOKIE_MAXIMUM_NAME_VALUE_LENGTH
Definition http.h:651
SOURCEMETA_CORE_HTTP_EXPORT auto http_content_type_matches(const std::string_view content_type_header, const std::string_view media_type) noexcept -> bool
SOURCEMETA_CORE_HTTP_EXPORT auto http_match_media_range(const std::string_view media_type, std::span< const std::string_view > ranges) noexcept -> std::string_view
SOURCEMETA_CORE_HTTP_EXPORT auto http_format_links(std::span< const HTTPLink > links, std::string &out) -> void
SOURCEMETA_CORE_HTTP_EXPORT auto http_challenge_valid(const HTTPChallenge &challenge) -> bool
SOURCEMETA_CORE_HTTP_EXPORT auto http_expire_cookie(const HTTPCookie &cookie) -> HTTPCookie
SOURCEMETA_CORE_HTTP_EXPORT auto http_negotiate_encoding(const std::string_view accept_encoding_header, const HTTPContentEncoding server_preference) noexcept -> std::optional< HTTPContentEncoding >
SOURCEMETA_CORE_HTTP_EXPORT auto http_serialize_challenges(std::span< const HTTPChallenge > challenges, std::string &out) -> bool
SOURCEMETA_CORE_HTTP_EXPORT auto http_format_vary(std::span< const std::string_view > field_names, std::string &out) -> bool
SOURCEMETA_CORE_HTTP_EXPORT auto http_format_link(const HTTPLink &link, std::string &out) -> void
SOURCEMETA_CORE_HTTP_EXPORT auto http_parse_challenges(const std::string_view input, std::vector< HTTPParsedChallenge > &challenges) -> bool
SOURCEMETA_CORE_HTTP_EXPORT auto http_accept_includes_all(const std::string_view accept_header, std::initializer_list< std::string_view > media_types) noexcept -> bool
SOURCEMETA_CORE_HTTP_EXPORT auto http_cookie_valid(const HTTPCookie &cookie) -> bool
SOURCEMETA_CORE_HTTP_EXPORT auto http_from_date(const std::string_view value) -> std::optional< std::chrono::system_clock::time_point >
HTTPContentEncoding
Definition http.h:55
SOURCEMETA_CORE_HTTP_EXPORT auto http_serialize_cache_control(const HTTPCacheControl &directives, std::string &out) -> bool
SOURCEMETA_CORE_HTTP_EXPORT auto http_cache_control_max_age(const std::string_view cache_control) noexcept -> std::optional< std::chrono::seconds >
@ Public
Definition http.h:350
@ Private
Definition http.h:353
@ Strict
The cookie is withheld from every cross-site request.
Definition http.h:613
@ None
The cookie is sent on every cross-site request.
Definition http.h:617
@ Lax
The cookie is sent on top-level cross-site navigations only.
Definition http.h:615