maph 1.0.0 High-Performance Memory-Mapped Key-Value Database with O(1) Lookups

Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions
httplib Namespace Reference

## Namespaces
namespace | detail

## Classes
class | Client
class | ClientImpl
class | ContentReader
class | DataSink
struct | FormData
struct | FormDataProvider
struct | FormField
struct | MultipartFormData
struct | Request
struct | Response
class | Result
class | Server
class | Stream
class | TaskQueue
class | ThreadPool
struct | UploadFormData

## Typedefs
using | Headers = std::unordered_multimap< std::string, std::string, detail::case_ignore::hash, detail::case_ignore::equal_to >
using | Params = std::multimap< std::string, std::string >
using | Match = std::smatch
using | DownloadProgress = std::function< bool(size_t current, size_t total)>
using | UploadProgress = std::function< bool(size_t current, size_t total)>
using | ResponseHandler = std::function< bool(const Response &response)>
using | FormFields = std::multimap< std::string, FormField >
using | FormFiles = std::multimap< std::string, FormData >
using | UploadFormDataItems = std::vector< UploadFormData >
using | ContentProvider = std::function< bool(size_t offset, size_t length, DataSink &sink)>
using | ContentProviderWithoutLength = std::function< bool(size_t offset, DataSink &sink)>
using | ContentProviderResourceReleaser = std::function< void(bool success)>
using | FormDataProviderItems = std::vector< FormDataProvider >
using | ContentReceiverWithProgress = std::function< bool(const char *data, size_t data_length, size_t offset, size_t total_length)>
using | ContentReceiver = std::function< bool(const char *data, size_t data_length)>
using | FormDataHeader = std::function< bool(const FormData &file)>
using | Range = std::pair< ssize_t, ssize_t >
using | Ranges = std::vector< Range >
using | Logger = std::function< void(const Request &, const Response &)>
using | ErrorLogger = std::function< void(const Error &, const Request *)>
using | SocketOptions = std::function< void(socket_t sock)>

## Enumerations
enum | SSLVerifierResponse { NoDecisionMade , CertificateAccepted , CertificateRejected }
enum | StatusCode { Continue_100 = 100 , SwitchingProtocol_101 = 101 , Processing_102 = 102 , EarlyHints_103 = 103 , OK_200 = 200 , Created_201 = 201 , Accepted_202 = 202 , NonAuthoritativeInformation_203 = 203 , NoContent_204 = 204 , ResetContent_205 = 205 , PartialContent_206 = 206 , MultiStatus_207 = 207 , AlreadyReported_208 = 208 , IMUsed_226 = 226 , MultipleChoices_300 = 300 , MovedPermanently_301 = 301 , Found_302 = 302 , SeeOther_303 = 303 , NotModified_304 = 304 , UseProxy_305 = 305 , unused_306 = 306 , TemporaryRedirect_307 = 307 , PermanentRedirect_308 = 308 , BadRequest_400 = 400 , Unauthorized_401 = 401 , PaymentRequired_402 = 402 , Forbidden_403 = 403 , NotFound_404 = 404 , MethodNotAllowed_405 = 405 , NotAcceptable_406 = 406 , ProxyAuthenticationRequired_407 = 407 , RequestTimeout_408 = 408 , Conflict_409 = 409 , Gone_410 = 410 , LengthRequired_411 = 411 , PreconditionFailed_412 = 412 , PayloadTooLarge_413 = 413 , UriTooLong_414 = 414 , UnsupportedMediaType_415 = 415 , RangeNotSatisfiable_416 = 416 , ExpectationFailed_417 = 417 , ImATeapot_418 = 418 , MisdirectedRequest_421 = 421 , UnprocessableContent_422 = 422 , Locked_423 = 423 , FailedDependency_424 = 424 , TooEarly_425 = 425 , UpgradeRequired_426 = 426 , PreconditionRequired_428 = 428 , TooManyRequests_429 = 429 , RequestHeaderFieldsTooLarge_431 = 431 , UnavailableForLegalReasons_451 = 451 , InternalServerError_500 = 500 , NotImplemented_501 = 501 , BadGateway_502 = 502 , ServiceUnavailable_503 = 503 , GatewayTimeout_504 = 504 , HttpVersionNotSupported_505 = 505 , VariantAlsoNegotiates_506 = 506 , InsufficientStorage_507 = 507 , LoopDetected_508 = 508 , NotExtended_510 = 510 , NetworkAuthenticationRequired_511 = 511 }
enum class | Error { Success = 0 , Unknown , Connection , BindIPAddress , Read , Write , ExceedRedirectCount , Canceled , SSLConnection , SSLLoadingCerts , SSLServerVerification , SSLServerHostnameVerification , UnsupportedMultipartBoundaryChars , Compression , ConnectionTimeout , ProxyConnection , ResourceExhaustion , TooManyFormDataFiles , ExceedMaxPayloadSize , ExceedUriMaxLength , ExceedMaxSocketDescriptorCount , InvalidRequestLine , InvalidHTTPMethod , InvalidHTTPVersion , InvalidHeaders , MultipartParsing , OpenFile , Listen , GetSockName , UnsupportedAddressFamily , HTTPParsing , InvalidRangeHeader , SSLPeerCouldBeClosed_ }

## Functions
void | default_socket_options (socket_t sock)
const char * | status_message (int status)
std::string | get_bearer_token_auth (const Request &req)
std::string | to_string (Error error)
std::ostream & | operator<< (std::ostream &os, const Error &obj)
std::string | hosted_at (const std::string &hostname)
void | hosted_at (const std::string &hostname, std::vector< std::string > &addrs)
std::string | encode_uri_component (const std::string &value)
std::string | encode_uri (const std::string &value)
std::string | decode_uri_component (const std::string &value)
std::string | decode_uri (const std::string &value)
std::string | encode_path_component (const std::string &component)
std::string | decode_path_component (const std::string &component)
std::string | encode_query_component (const std::string &component, bool space_as_plus=true)
std::string | decode_query_component (const std::string &component, bool plus_as_space=true)
std::string | append_query_params (const std::string &path, const Params &params)
std::pair< std::string, std::string > | make_range_header (const Ranges &ranges)
std::pair< std::string, std::string > | make_basic_authentication_header (const std::string &username, const std::string &password, bool is_proxy=false)
std::pair< std::string, std::string > | make_bearer_token_authentication_header (const std::string &token, bool is_proxy=false)

## Class Documentation

## ◆ httplib::FormData

struct httplib::FormData

Definition at line 592 of file httplib.h.

Collaboration diagram for httplib::FormData:

Class Members
string | content |
string | content_type |
string | filename |
Headers | headers |
string | name |

## ◆ httplib::FormDataProvider

struct httplib::FormDataProvider

Definition at line 675 of file httplib.h.

Collaboration diagram for httplib::FormDataProvider:

Class Members
string | content_type |
string | filename |
string | name |
ContentProviderWithoutLength | provider |

## ◆ httplib::FormField

struct httplib::FormField

Definition at line 600 of file httplib.h.

Collaboration diagram for httplib::FormField:

Class Members
string | content |
Headers | headers |
string | name |

## ◆ httplib::UploadFormData

struct httplib::UploadFormData

Definition at line 626 of file httplib.h.

Collaboration diagram for httplib::UploadFormData:

Class Members
string | content |
string | content_type |
string | filename |
string | name |

## Typedef Documentation

## ◆ ContentProvider

using httplib::ContentProvider = typedef std::function<bool(size_t offset, size_t length, DataSink &sink)>

Definition at line 667 of file httplib.h.

## ◆ ContentProviderResourceReleaser

using httplib::ContentProviderResourceReleaser = typedef std::function<void(bool success)>

Definition at line 673 of file httplib.h.

## ◆ ContentProviderWithoutLength

using httplib::ContentProviderWithoutLength = typedef std::function<bool(size_t offset, DataSink &sink)>

Definition at line 670 of file httplib.h.

## ◆ ContentReceiver

using httplib::ContentReceiver = typedef std::function<bool(const char *data, size_t data_length)>

Definition at line 686 of file httplib.h.

## ◆ ContentReceiverWithProgress

using httplib::ContentReceiverWithProgress = typedef std::function<bool( const char *data, size_t data_length, size_t offset, size_t total_length)>

Definition at line 683 of file httplib.h.

## ◆ DownloadProgress

using httplib::DownloadProgress = typedef std::function<bool(size_t current, size_t total)>

Definition at line 586 of file httplib.h.

## ◆ ErrorLogger

using httplib::ErrorLogger = typedef std::function<void(const Error &, const Request *)>

Definition at line 959 of file httplib.h.

## ◆ FormDataHeader

using httplib::FormDataHeader = typedef std::function<bool(const FormData &file)>

Definition at line 689 of file httplib.h.

## ◆ FormDataProviderItems

using httplib::FormDataProviderItems = typedef std::vector<FormDataProvider>

Definition at line 681 of file httplib.h.

## ◆ FormFields

using httplib::FormFields = typedef std::multimap<std::string, FormField>

Definition at line 605 of file httplib.h.

## ◆ FormFiles

using httplib::FormFiles = typedef std::multimap<std::string, FormData>

Definition at line 607 of file httplib.h.

## ◆ Headers

using httplib::Headers = typedef std::unordered_multimap<std::string, std::string, detail::case_ignore::hash, detail::case_ignore::equal_to>

Definition at line 579 of file httplib.h.

## ◆ Logger

using httplib::Logger = typedef std::function<void(const Request &, const Response &)>

Definition at line 955 of file httplib.h.

## ◆ Match

using httplib::Match = typedef std::smatch

Definition at line 584 of file httplib.h.

## ◆ Params

using httplib::Params = typedef std::multimap<std::string, std::string>

Definition at line 583 of file httplib.h.

## ◆ Range

using httplib::Range = typedef std::pair<ssize_t, ssize_t>

Definition at line 713 of file httplib.h.

## ◆ Ranges

using httplib::Ranges = typedef std::vector<Range>

Definition at line 714 of file httplib.h.

## ◆ ResponseHandler

using httplib::ResponseHandler = typedef std::function<bool(const Response &response)>

Definition at line 590 of file httplib.h.

## ◆ SocketOptions

using httplib::SocketOptions = typedef std::function<void(socket_t sock)>

Definition at line 961 of file httplib.h.

## ◆ UploadFormDataItems

using httplib::UploadFormDataItems = typedef std::vector<UploadFormData>

Definition at line 632 of file httplib.h.

## ◆ UploadProgress

using httplib::UploadProgress = typedef std::function<bool(size_t current, size_t total)>

Definition at line 587 of file httplib.h.

## Enumeration Type Documentation

## ◆ Error

enum class httplib::Error
| strong

Enumerator
Success |
Unknown |
Connection |
BindIPAddress |
Read |
Write |
ExceedRedirectCount |
Canceled |
SSLConnection |
SSLLoadingCerts |
SSLServerVerification |
SSLServerHostnameVerification |
UnsupportedMultipartBoundaryChars |
Compression |
ConnectionTimeout |
ProxyConnection |
ResourceExhaustion |
TooManyFormDataFiles |
ExceedMaxPayloadSize |
ExceedUriMaxLength |
ExceedMaxSocketDescriptorCount |
InvalidRequestLine |
InvalidHTTPMethod |
InvalidHTTPVersion |
InvalidHeaders |
MultipartParsing |
OpenFile |
Listen |
GetSockName |
UnsupportedAddressFamily |
HTTPParsing |
InvalidRangeHeader |
SSLPeerCouldBeClosed_ |

Definition at line 1284 of file httplib.h.

## ◆ SSLVerifierResponse

enum httplib::SSLVerifierResponse

Enumerator
NoDecisionMade |
CertificateAccepted |
CertificateRejected |

Definition at line 495 of file httplib.h.

## ◆ StatusCode

enum httplib::StatusCode

Enumerator
Continue_100 |
SwitchingProtocol_101 |
Processing_102 |
EarlyHints_103 |
OK_200 |
Created_201 |
Accepted_202 |
NonAuthoritativeInformation_203 |
NoContent_204 |
ResetContent_205 |
PartialContent_206 |
MultiStatus_207 |
AlreadyReported_208 |
IMUsed_226 |
MultipleChoices_300 |
MovedPermanently_301 |
Found_302 |
SeeOther_303 |
NotModified_304 |
UseProxy_305 |
unused_306 |
TemporaryRedirect_307 |
PermanentRedirect_308 |
BadRequest_400 |
Unauthorized_401 |
PaymentRequired_402 |
Forbidden_403 |
NotFound_404 |
MethodNotAllowed_405 |
NotAcceptable_406 |
ProxyAuthenticationRequired_407 |
RequestTimeout_408 |
Conflict_409 |
Gone_410 |
LengthRequired_411 |
PreconditionFailed_412 |
PayloadTooLarge_413 |
UriTooLong_414 |
UnsupportedMediaType_415 |
RangeNotSatisfiable_416 |
ExpectationFailed_417 |
ImATeapot_418 |
MisdirectedRequest_421 |
UnprocessableContent_422 |
Locked_423 |
FailedDependency_424 |
TooEarly_425 |
UpgradeRequired_426 |
PreconditionRequired_428 |
TooManyRequests_429 |
RequestHeaderFieldsTooLarge_431 |
UnavailableForLegalReasons_451 |
InternalServerError_500 |
NotImplemented_501 |
BadGateway_502 |
ServiceUnavailable_503 |
GatewayTimeout_504 |
HttpVersionNotSupported_505 |
VariantAlsoNegotiates_506 |
InsufficientStorage_507 |
LoopDetected_508 |
NotExtended_510 |
NetworkAuthenticationRequired_511 |

Definition at line 504 of file httplib.h.

## Function Documentation

## ◆ append_query_params()

std::string httplib::append_query_params | ( | const std::string & | path,
|  | const Params & | params
| ) |  |
| inline

Definition at line 6691 of file httplib.h.

References append_query_params().

Referenced by append_query_params(), httplib::ClientImpl::Get(), and httplib::ClientImpl::Get().

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

## ◆ decode_path_component()

std::string httplib::decode_path_component | ( | const std::string & | component | ) |
| inline

Definition at line 6576 of file httplib.h.

References decode_path_component().

Referenced by decode_path_component().

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

## ◆ decode_query_component()

std::string httplib::decode_query_component | ( | const std::string & | component,
|  | bool | plus_as_space = `true`
| ) |  |
| inline

Definition at line 6666 of file httplib.h.

References decode_query_component().

Referenced by decode_query_component().

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

## ◆ decode_uri()

std::string httplib::decode_uri | ( | const std::string & | value | ) |
| inline

Definition at line 6521 of file httplib.h.

References decode_uri().

Referenced by decode_uri().

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

## ◆ decode_uri_component()

std::string httplib::decode_uri_component | ( | const std::string & | value | ) |
| inline

Definition at line 6501 of file httplib.h.

References decode_uri_component().

Referenced by decode_uri_component().

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

## ◆ default_socket_options()

void httplib::default_socket_options | ( | socket_t | sock | ) |
| inline

Definition at line 2120 of file httplib.h.

References httplib::detail::set_socket_opt().

Here is the call graph for this function:

## ◆ encode_path_component()

std::string httplib::encode_path_component | ( | const std::string & | component | ) |
| inline

Definition at line 6541 of file httplib.h.

References encode_path_component().

Referenced by encode_path_component().

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

## ◆ encode_query_component()

std::string httplib::encode_query_component | ( | const std::string & | component,
|  | bool | space_as_plus = `true`
| ) |  |
| inline

Definition at line 6612 of file httplib.h.

References encode_query_component().

Referenced by encode_query_component().

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

## ◆ encode_uri()

std::string httplib::encode_uri | ( | const std::string & | value | ) |
| inline

Definition at line 6479 of file httplib.h.

References encode_uri().

Referenced by encode_uri().

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

## ◆ encode_uri_component()

std::string httplib::encode_uri_component | ( | const std::string & | value | ) |
| inline

Definition at line 6458 of file httplib.h.

References encode_uri_component().

Referenced by encode_uri_component().

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

## ◆ get_bearer_token_auth()

std::string httplib::get_bearer_token_auth | ( | const Request & | req | ) |
| inline

Definition at line 2206 of file httplib.h.

References httplib::Request::get_header_value(), and httplib::Request::has_header().

Here is the call graph for this function:

## ◆ hosted_at() [1/2]

std::string httplib::hosted_at | ( | const std::string & | hostname | ) |
| inline

Definition at line 6420 of file httplib.h.

References hosted_at().

Referenced by hosted_at(), and hosted_at().

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

## ◆ hosted_at() [2/2]

void httplib::hosted_at | ( | const std::string & | hostname,
|  | std::vector< std::string > & | addrs
| ) |  |
| inline

Definition at line 6427 of file httplib.h.

References hosted_at().

Here is the call graph for this function:

## ◆ make_basic_authentication_header()

std::pair< std::string, std::string > httplib::make_basic_authentication_header | ( | const std::string & | username,
|  | const std::string & | password,
|  | bool | is_proxy = `false`
| ) |  |
| inline

Definition at line 6716 of file httplib.h.

References make_basic_authentication_header().

Referenced by make_basic_authentication_header().

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

## ◆ make_bearer_token_authentication_header()

std::pair< std::string, std::string > httplib::make_bearer_token_authentication_header | ( | const std::string & | token,
|  | bool | is_proxy = `false`
| ) |  |
| inline

Definition at line 6724 of file httplib.h.

References make_bearer_token_authentication_header().

Referenced by make_bearer_token_authentication_header().

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

## ◆ make_range_header()

std::pair< std::string, std::string > httplib::make_range_header | ( | const Ranges & | ranges | ) |
| inline

Definition at line 6702 of file httplib.h.

References make_range_header().

Referenced by make_range_header().

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

## ◆ operator<<()

std::ostream & httplib::operator<< | ( | std::ostream & | os,
|  | const Error & | obj
| ) |  |
| inline

Definition at line 2282 of file httplib.h.

References to_string().

Here is the call graph for this function:

## ◆ status_message()

const char * httplib::status_message | ( | int | status | ) |
| inline

Definition at line 2130 of file httplib.h.

References Accepted_202, AlreadyReported_208, BadGateway_502, BadRequest_400, Conflict_409, Continue_100, Created_201, EarlyHints_103, ExpectationFailed_417, FailedDependency_424, Forbidden_403, Found_302, GatewayTimeout_504, Gone_410, HttpVersionNotSupported_505, ImATeapot_418, IMUsed_226, InsufficientStorage_507, InternalServerError_500, LengthRequired_411, Locked_423, LoopDetected_508, MethodNotAllowed_405, MisdirectedRequest_421, MovedPermanently_301, MultipleChoices_300, MultiStatus_207, NetworkAuthenticationRequired_511, NoContent_204, NonAuthoritativeInformation_203, NotAcceptable_406, NotExtended_510, NotFound_404, NotImplemented_501, NotModified_304, OK_200, PartialContent_206, PayloadTooLarge_413, PaymentRequired_402, PermanentRedirect_308, PreconditionFailed_412, PreconditionRequired_428, Processing_102, ProxyAuthenticationRequired_407, RangeNotSatisfiable_416, RequestHeaderFieldsTooLarge_431, RequestTimeout_408, ResetContent_205, SeeOther_303, ServiceUnavailable_503, SwitchingProtocol_101, TemporaryRedirect_307, TooEarly_425, TooManyRequests_429, Unauthorized_401, UnavailableForLegalReasons_451, UnprocessableContent_422, UnsupportedMediaType_415, unused_306, UpgradeRequired_426, UriTooLong_414, UseProxy_305, and VariantAlsoNegotiates_506.

## ◆ to_string()

std::string httplib::to_string | ( | Error | error | ) |
| inline

Definition at line 2239 of file httplib.h.

References BindIPAddress, Canceled, Compression, Connection, ConnectionTimeout, ExceedMaxPayloadSize, ExceedMaxSocketDescriptorCount, ExceedRedirectCount, ExceedUriMaxLength, GetSockName, HTTPParsing, InvalidHeaders, InvalidHTTPMethod, InvalidHTTPVersion, InvalidRangeHeader, InvalidRequestLine, Listen, MultipartParsing, OpenFile, ProxyConnection, Read, ResourceExhaustion, SSLConnection, SSLLoadingCerts, SSLServerHostnameVerification, SSLServerVerification, Success, TooManyFormDataFiles, Unknown, UnsupportedAddressFamily, UnsupportedMultipartBoundaryChars, and Write.

Referenced by operator<<().

Here is the caller graph for this function: