Thoth
A functional, expressive, asynchronous C++26 webdev library
Loading...
Searching...
No Matches
Thoth::Http::ResponseHeaders Struct Reference

#include <ResponseHeaders.hpp>

Inheritance diagram for Thoth::Http::ResponseHeaders:
[legend]

Public Member Functions

Response Specific Proxies

Convenient calls to some headers.

NHeaders::ValueProxy< false, NHeaders::AcceptRangesAcceptRanges ()
 Defines if the response accepts bytes or no (just "bytes" or "none" is available).
 
NHeaders::ValueProxy< true, NHeaders::AcceptRangesAcceptRanges () const
 Defines if the response accepts bytes or no (just "bytes" or "none" is available).
 
NHeaders::ListProxy< false, NHeaders::MimeTypeAcceptPatch ()
 The value of the Accept-Patch header.
 
NHeaders::ListProxy< true, NHeaders::MimeTypeAcceptPatch () const
 The value of the Accept-Patch header.
 
NHeaders::ListProxy< false, NHeaders::MimeTypeAcceptPost ()
 The value of the Accept-Patch header.
 
NHeaders::ListProxy< true, NHeaders::MimeTypeAcceptPost () const
 The value of the Accept-Patch header.
 
NHeaders::ValueProxy< false, std::chrono::seconds > Age ()
 Get how old this response has generated in the server, useful for caching.
 
NHeaders::ValueProxy< true, std::chrono::seconds > Age () const
 Get how old this response has generated in the server, useful for caching.
 
NHeaders::ValueProxy< false, NHeaders::EntityTagEntityTag ()
 The "ETag" header.
 
NHeaders::ValueProxy< true, NHeaders::EntityTagEntityTag () const
 The "ETag" header.
 
NHeaders::ValueProxy< false, std::string > Location ()
 The URL where this response pointers to.
 
NHeaders::ValueProxy< true, std::string > Location () const
 The URL where this response pointers to.
 
NHeaders::ValueProxy< false, std::string > ProxyAuthenticate ()
 The "proxy-authenticate" header.
 
NHeaders::ValueProxy< true, std::string > ProxyAuthenticate () const
 The "proxy-authenticate" header.
 
NHeaders::ValueProxy< false, std::chrono::utc_clock::time_point, std::chrono::seconds > RetryAfter ()
 The date or cooldown when the endpoint will accept new responses.
 
NHeaders::ValueProxy< true, std::chrono::utc_clock::time_point, std::chrono::seconds > RetryAfter () const
 The date or cooldown when the endpoint will accept new responses.
 
NHeaders::ValueProxy< false, std::string > Server ()
 The type of server.
 
NHeaders::ValueProxy< true, std::string > Server () const
 The type of server.
 
NHeaders::ListProxy< false, std::string > Vary ()
 The "vary" header.
 
NHeaders::ListProxy< true, std::string > Vary () const
 The "vary" header.
 
NHeaders::ValueProxy< false, std::string > WwwAuthenticate ()
 The types of authentication that the server utilizes.
 
NHeaders::ValueProxy< true, std::string > WwwAuthenticate () const
 The types of authentication that the server utilizes.
 
- Public Member Functions inherited from Thoth::Http::Headers
 Headers ()
 
 Headers (const MapType &initAs)
 Create with an existing vector.
 
 Headers (std::initializer_list< HeaderPair > init)
 
bool Exists (HeaderKeyRef key) const
 check if a key exists.
 
bool Exists (HeaderPairRef p) const
 check if a key exists.
 
bool Exists (HeaderKeyRef key, HeaderValueRef val) const
 check if a key=val exists.
 
void Add (HeaderPairRef p)
 Add a value with the specified key. Append if already exists.
 
void Add (HeaderKeyRef key, HeaderValueRef val)
 same as Add(HeaderPairRef p).
 
void Set (HeaderPairRef p)
 Add a value with the specified key. Replace if already exists.
 
void Set (HeaderKeyRef key, HeaderValueRef val)
 same as Add(HeaderPairRef p).
 
bool Remove (HeaderPairRef p)
 Remove a value with the specified key.
 
bool Remove (HeaderKeyRef key, HeaderValueRef val)
 same as Remove(HeaderPairRef p).
 
bool SetIfNull (HeaderPairRef p)
 If key not exists, set it to value.
 
bool SetIfNull (HeaderKeyRef key, HeaderValueRef val)
 same as SetIfNull(HeaderPairRef p).
 
std::optional< HeaderValue * > Get (HeaderKeyRef key)
 Get the reference of a key but don't create if it not exists.
 
std::optional< const HeaderValue * > Get (HeaderKeyRef key) const
 Get the reference of a key but don't create if it not exists.
 
IterType begin ()
 
IterType end ()
 
CIterType begin () const
 
CIterType end () const
 
RIterType rbegin ()
 
RIterType rend ()
 
CRIterType rbegin () const
 
CRIterType rend () const
 
void Clear ()
 Clear all keys.
 
size_t Size () const
 
bool Empty () const
 
HeaderValueoperator[] (HeaderKeyRef key)
 
bool operator== (const Headers &other) const
 
NHeaders::ListProxy< false, NHeaders::MimeTypeAccept ()
 Accept-Encoding header (gzip, br, etc).
 
NHeaders::ListProxy< true, NHeaders::MimeTypeAccept () const
 
NHeaders::ListProxy< false, NHeaders::AcceptEncodingEnumAcceptEncoding ()
 Accept-Encoding header (gzip, br, etc).
 
NHeaders::ListProxy< true, NHeaders::AcceptEncodingEnumAcceptEncoding () const
 
NHeaders::ValueProxy< false, NHeaders::MimeTypeContentType ()
 Defines the media type of the resource (MIME).
 
NHeaders::ValueProxy< true, NHeaders::MimeTypeContentType () const
 Defines the media type of the resource (MIME).
 
NHeaders::ValueProxy< false, uint64_t > ContentLength ()
 The size of the entity-body in bytes.
 
NHeaders::ValueProxy< true, uint64_t > ContentLength () const
 The size of the entity-body in bytes.
 
NHeaders::ListProxy< false, NHeaders::ContentEncodingEnumContentEncoding ()
 List of encodings (compression) applied to the entity.
 
NHeaders::ListProxy< true, NHeaders::ContentEncodingEnumContentEncoding () const
 List of encodings (compression) applied to the entity.
 
NHeaders::ListProxy< false, NHeaders::TransferEncodingEnumTransferEncoding ()
 List of compression applied to the entity.
 
NHeaders::ListProxy< true, NHeaders::TransferEncodingEnumTransferEncoding () const
 List of compression applied to the entity.
 
NHeaders::ListProxy< false, std::string > ContentLanguage ()
 Natural languages for the intended audience (e.g., "en-US").
 
NHeaders::ListProxy< true, std::string > ContentLanguage () const
 Natural languages for the intended audience (e.g., "en-US").
 
NHeaders::ValueProxy< false, std::string > ContentLocation ()
 The specific location for the entity-body.
 
NHeaders::ValueProxy< true, std::string > ContentLocation () const
 The specific location for the entity-body.
 
NHeaders::ValueProxy< false, std::chrono::utc_clock::time_point > Date ()
 Date and time at which the message was originated.
 
NHeaders::ValueProxy< true, std::chrono::utc_clock::time_point > Date () const
 Date and time at which the message was originated.
 
NHeaders::ListProxy< false, std::string > Connection ()
 Options for the current connection.
 
NHeaders::ListProxy< true, std::string > Connection () const
 Options for the current connection.
 
NHeaders::ListProxy< false, NHeaders::UpgradeUpgrade ()
 Used to signal a protocol change (e.g., "websocket").
 
NHeaders::ListProxy< true, NHeaders::UpgradeUpgrade () const
 Used to signal a protocol change (e.g., "websocket").
 
NHeaders::ListProxy< false, std::string > Trailer ()
 Indicates header fields present in the trailer of a chunked message.
 
NHeaders::ListProxy< true, std::string > Trailer () const
 Indicates header fields present in the trailer of a chunked message.
 
NHeaders::ListProxy< false, std::string > Via ()
 Path taken by the request/response through proxies (free std::string).
 
NHeaders::ListProxy< true, std::string > Via () const
 Path taken by the request/response through proxies (free std::string).
 

Additional Inherited Members

- Public Types inherited from Thoth::Http::Headers
using HeaderKey = NHeaders::HeaderKey
 
using HeaderKeyRef = NHeaders::HeaderKeyRef
 
using HeaderValue = NHeaders::HeaderValue
 
using HeaderValueRef = NHeaders::HeaderValueRef
 
using HeaderPair = NHeaders::HeaderPair
 
using HeaderPairRef = NHeaders::HeaderPairRef
 
using MapType = NHeaders::MapType
 
using MapType = std::vector< HeaderPair >
 
using IterType = decltype(MapType{}.begin())
 
using CIterType = decltype(MapType{}.cbegin())
 
using RIterType = decltype(MapType{}.rbegin())
 
using CRIterType = decltype(MapType{}.crbegin())
 
- Static Public Member Functions inherited from Thoth::Http::Headers
template<std::ranges::input_range R>
static WebResult< HeadersParse (R &headers, size_t maxHeadersLength=1<< 16)
 Tries to parse the headers from the raw TCP std::string.
 
static Headers DefaultHeaders ()
 

Member Function Documentation

◆ AcceptPatch() [1/2]

NHeaders::ListProxy< false, NHeaders::MimeType > Thoth::Http::ResponseHeaders::AcceptPatch ( )

The value of the Accept-Patch header.

◆ AcceptPatch() [2/2]

NHeaders::ListProxy< true, NHeaders::MimeType > Thoth::Http::ResponseHeaders::AcceptPatch ( ) const

The value of the Accept-Patch header.

◆ AcceptPost() [1/2]

NHeaders::ListProxy< false, NHeaders::MimeType > Thoth::Http::ResponseHeaders::AcceptPost ( )

The value of the Accept-Patch header.

◆ AcceptPost() [2/2]

NHeaders::ListProxy< true, NHeaders::MimeType > Thoth::Http::ResponseHeaders::AcceptPost ( ) const

The value of the Accept-Patch header.

◆ AcceptRanges() [1/2]

NHeaders::ValueProxy< false, NHeaders::AcceptRanges > Thoth::Http::ResponseHeaders::AcceptRanges ( )

Defines if the response accepts bytes or no (just "bytes" or "none" is available).

◆ AcceptRanges() [2/2]

NHeaders::ValueProxy< true, NHeaders::AcceptRanges > Thoth::Http::ResponseHeaders::AcceptRanges ( ) const

Defines if the response accepts bytes or no (just "bytes" or "none" is available).

◆ Age() [1/2]

NHeaders::ValueProxy< false, std::chrono::seconds > Thoth::Http::ResponseHeaders::Age ( )

Get how old this response has generated in the server, useful for caching.

◆ Age() [2/2]

NHeaders::ValueProxy< true, std::chrono::seconds > Thoth::Http::ResponseHeaders::Age ( ) const

Get how old this response has generated in the server, useful for caching.

◆ EntityTag() [1/2]

NHeaders::ValueProxy< false, NHeaders::EntityTag > Thoth::Http::ResponseHeaders::EntityTag ( )

The "ETag" header.

◆ EntityTag() [2/2]

NHeaders::ValueProxy< true, NHeaders::EntityTag > Thoth::Http::ResponseHeaders::EntityTag ( ) const

The "ETag" header.

◆ Location() [1/2]

NHeaders::ValueProxy< false, std::string > Thoth::Http::ResponseHeaders::Location ( )

The URL where this response pointers to.

◆ Location() [2/2]

NHeaders::ValueProxy< true, std::string > Thoth::Http::ResponseHeaders::Location ( ) const

The URL where this response pointers to.

◆ ProxyAuthenticate() [1/2]

NHeaders::ValueProxy< false, std::string > Thoth::Http::ResponseHeaders::ProxyAuthenticate ( )

The "proxy-authenticate" header.

◆ ProxyAuthenticate() [2/2]

NHeaders::ValueProxy< true, std::string > Thoth::Http::ResponseHeaders::ProxyAuthenticate ( ) const

The "proxy-authenticate" header.

◆ RetryAfter() [1/2]

NHeaders::ValueProxy< false, std::chrono::utc_clock::time_point, std::chrono::seconds > Thoth::Http::ResponseHeaders::RetryAfter ( )

The date or cooldown when the endpoint will accept new responses.

◆ RetryAfter() [2/2]

NHeaders::ValueProxy< true, std::chrono::utc_clock::time_point, std::chrono::seconds > Thoth::Http::ResponseHeaders::RetryAfter ( ) const

The date or cooldown when the endpoint will accept new responses.

◆ Server() [1/2]

NHeaders::ValueProxy< false, std::string > Thoth::Http::ResponseHeaders::Server ( )

The type of server.

◆ Server() [2/2]

NHeaders::ValueProxy< true, std::string > Thoth::Http::ResponseHeaders::Server ( ) const

The type of server.

◆ Vary() [1/2]

NHeaders::ListProxy< false, std::string > Thoth::Http::ResponseHeaders::Vary ( )

The "vary" header.

◆ Vary() [2/2]

NHeaders::ListProxy< true, std::string > Thoth::Http::ResponseHeaders::Vary ( ) const

The "vary" header.

◆ WwwAuthenticate() [1/2]

NHeaders::ValueProxy< false, std::string > Thoth::Http::ResponseHeaders::WwwAuthenticate ( )

The types of authentication that the server utilizes.

◆ WwwAuthenticate() [2/2]

NHeaders::ValueProxy< true, std::string > Thoth::Http::ResponseHeaders::WwwAuthenticate ( ) const

The types of authentication that the server utilizes.


The documentation for this struct was generated from the following file: