Bitcoin Core 31.99.0
P2P Digital Currency
Public Member Functions | Private Attributes | List of all members
http_bitcoin::HTTPHeaders Class Reference

#include <httpserver.h>

Public Member Functions

std::optional< std::string > FindFirst (std::string_view key) const
 
std::vector< std::string_view > FindAll (std::string_view key) const
 
void Write (std::string &&key, std::string &&value)
 
void RemoveAll (std::string_view key)
 
bool Read (util::LineReader &reader)
 
std::string Stringify () const
 

Private Attributes

std::vector< std::pair< std::string, std::string > > m_headers
 Headers can have duplicate field names, so we use a vector of key-value pairs instead of a map. More...
 

Detailed Description

Definition at line 88 of file httpserver.h.

Member Function Documentation

◆ FindAll()

std::vector< std::string_view > http_bitcoin::HTTPHeaders::FindAll ( std::string_view  key) const
Parameters
[in]keyThe field-name of the header to search for
Returns
Views into all values matching the provided key (valid while this object is alive)

Definition at line 276 of file httpserver.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindFirst()

std::optional< std::string > http_bitcoin::HTTPHeaders::FindFirst ( std::string_view  key) const
Parameters
[in]keyThe field-name of the header to search for
Returns
The value of the first header that matches the provided key nullopt if key is not found

Definition at line 266 of file httpserver.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Read()

bool http_bitcoin::HTTPHeaders::Read ( util::LineReader reader)
Returns
false if LineReader hits the end of the buffer before reading an
, meaning that we are still waiting on more data from the client. true after reading an entire HTTP headers section, terminated by an empty line and
.
Exceptions
onexceeded read limit and on bad headers syntax (e.g. no ":" in a line)

Definition at line 300 of file httpserver.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RemoveAll()

void http_bitcoin::HTTPHeaders::RemoveAll ( std::string_view  key)
Parameters
[in]keyThe field-name of the header to search for and delete

Definition at line 292 of file httpserver.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stringify()

std::string http_bitcoin::HTTPHeaders::Stringify ( ) const

Definition at line 344 of file httpserver.cpp.

Here is the caller graph for this function:

◆ Write()

void http_bitcoin::HTTPHeaders::Write ( std::string &&  key,
std::string &&  value 
)

Definition at line 287 of file httpserver.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ m_headers

std::vector<std::pair<std::string, std::string> > http_bitcoin::HTTPHeaders::m_headers
private

Headers can have duplicate field names, so we use a vector of key-value pairs instead of a map.

https://httpwg.org/specs/rfc9110.html#rfc.section.5.2

Definition at line 122 of file httpserver.h.


The documentation for this class was generated from the following files: