camcom 1.0.0-pre2
 
Loading...
Searching...
No Matches
httplib Namespace Reference

Namespaces

namespace  detail
 
namespace  sse
 
namespace  stream
 
namespace  ws
 

Classes

class  any
 
class  bad_any_cast
 
class  Client
 
struct  ClientConnection
 
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
 
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
 
using ContentProviderWithoutLength
 
using ContentProviderResourceReleaser = std::function<void(bool success)>
 
using FormDataProviderItems = std::vector<FormDataProvider>
 
using ContentReceiverWithProgress
 
using ContentReceiver
 
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 ,
  ConnectionClosed , Timeout , ResourceExhaustion , TooManyFormDataFiles ,
  ExceedMaxPayloadSize , ExceedUriMaxLength , ExceedMaxSocketDescriptorCount , InvalidRequestLine ,
  InvalidHTTPMethod , InvalidHTTPVersion , InvalidHeaders , MultipartParsing ,
  OpenFile , Listen , GetSockName , UnsupportedAddressFamily ,
  HTTPParsing , InvalidRangeHeader , SSLPeerCouldBeClosed_
}
 

Functions

template<typename T>
T * any_cast (any *a)
 
template<typename T>
const T * any_cast (const any *a)
 
template<typename T>
any_cast (const any &a)
 
template<typename T>
any_cast (any &a)
 
template<typename T>
any_cast (any &&a)
 
FormDataProvider make_file_provider (const std::string &name, const std::string &filepath, const std::string &filename=std::string(), const std::string &content_type=std::string())
 
std::pair< size_t, ContentProvidermake_file_body (const std::string &filepath)
 
std::string to_string (Error error)
 
std::ostream & operator<< (std::ostream &os, const Error &obj)
 
void default_socket_options (socket_t sock)
 
const char * status_message (int status)
 
std::string get_bearer_token_auth (const Request &req)
 
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 sanitize_filename (const std::string &filename)
 
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)
 
std::string get_client_ip (const std::string &x_forwarded_for, const std::vector< std::string > &trusted_proxies)
 

Typedef Documentation

◆ ContentProvider

Initial value:
std::function<bool(size_t offset, size_t length, DataSink &sink)>
Definition httplib.h:986

◆ ContentProviderResourceReleaser

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

◆ ContentProviderWithoutLength

Initial value:
std::function<bool(size_t offset, DataSink &sink)>

◆ ContentReceiver

Initial value:
std::function<bool(const char *data, size_t data_length)>

◆ ContentReceiverWithProgress

Initial value:
std::function<bool(
const char *data, size_t data_length, size_t offset, size_t total_length)>

◆ DownloadProgress

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

◆ ErrorLogger

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

◆ FormDataHeader

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

◆ FormDataProviderItems

◆ FormFields

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

◆ FormFiles

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

◆ Headers

Initial value:
std::unordered_multimap<std::string, std::string, detail::case_ignore::hash,
Definition httplib.h:579

◆ Logger

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

◆ Match

using httplib::Match = std::smatch

◆ Params

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

◆ Range

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

◆ Ranges

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

◆ ResponseHandler

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

◆ SocketOptions

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

◆ UploadFormDataItems

◆ UploadProgress

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

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 
ConnectionClosed 
Timeout 
ResourceExhaustion 
TooManyFormDataFiles 
ExceedMaxPayloadSize 
ExceedUriMaxLength 
ExceedMaxSocketDescriptorCount 
InvalidRequestLine 
InvalidHTTPMethod 
InvalidHTTPVersion 
InvalidHeaders 
MultipartParsing 
OpenFile 
Listen 
GetSockName 
UnsupportedAddressFamily 
HTTPParsing 
InvalidRangeHeader 
SSLPeerCouldBeClosed_ 

◆ SSLVerifierResponse

Enumerator
NoDecisionMade 
CertificateAccepted 
CertificateRejected 

◆ 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 

Function Documentation

◆ any_cast() [1/5]

template<typename T>
T httplib::any_cast ( any && a)

◆ any_cast() [2/5]

template<typename T>
T httplib::any_cast ( any & a)

◆ any_cast() [3/5]

template<typename T>
T * httplib::any_cast ( any * a)
noexcept

◆ any_cast() [4/5]

template<typename T>
T httplib::any_cast ( const any & a)

◆ any_cast() [5/5]

template<typename T>
const T * httplib::any_cast ( const any * a)
noexcept

◆ append_query_params()

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

◆ decode_path_component()

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

◆ decode_query_component()

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

◆ decode_uri()

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

◆ decode_uri_component()

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

◆ default_socket_options()

void httplib::default_socket_options ( socket_t sock)
inline

◆ encode_path_component()

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

◆ encode_query_component()

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

◆ encode_uri()

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

◆ encode_uri_component()

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

◆ get_bearer_token_auth()

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

◆ get_client_ip()

std::string httplib::get_client_ip ( const std::string & x_forwarded_for,
const std::vector< std::string > & trusted_proxies )
inline

◆ hosted_at() [1/2]

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

◆ hosted_at() [2/2]

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

◆ 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

◆ 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

◆ make_file_body()

std::pair< size_t, ContentProvider > httplib::make_file_body ( const std::string & filepath)
inline

◆ make_file_provider()

FormDataProvider httplib::make_file_provider ( const std::string & name,
const std::string & filepath,
const std::string & filename = std::string(),
const std::string & content_type = std::string() )
inline

◆ make_range_header()

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

◆ operator<<()

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

◆ sanitize_filename()

std::string httplib::sanitize_filename ( const std::string & filename)
inline

◆ status_message()

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

◆ to_string()

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