Goby3  3.1.5a
2024.05.23
httplib Namespace Reference

Namespaces

 detail
 

Classes

class  Client
 
class  ClientImpl
 
class  ContentReader
 
class  DataSink
 
struct  MultipartFormData
 
struct  MultipartFormDataProvider
 
struct  Request
 
struct  Response
 
class  Result
 
class  Server
 
class  Stream
 
class  TaskQueue
 
class  ThreadPool
 

Typedefs

using Headers = std::multimap< std::string, std::string, detail::ci >
 
using Params = std::multimap< std::string, std::string >
 
using Match = std::smatch
 
using Progress = std::function< bool(uint64_t current, uint64_t total)>
 
using ResponseHandler = std::function< bool(const Response &response)>
 
using MultipartFormDataItems = std::vector< MultipartFormData >
 
using MultipartFormDataMap = std::multimap< std::string, MultipartFormData >
 
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 MultipartFormDataProviderItems = std::vector< MultipartFormDataProvider >
 
using ContentReceiverWithProgress = std::function< bool(const char *data, size_t data_length, uint64_t offset, uint64_t total_length)>
 
using ContentReceiver = std::function< bool(const char *data, size_t data_length)>
 
using MultipartContentHeader = std::function< bool(const MultipartFormData &file)>
 
using Range = std::pair< ssize_t, ssize_t >
 
using Ranges = std::vector< Range >
 
using Logger = std::function< void(const Request &, const Response &)>
 
using SocketOptions = std::function< void(socket_t sock)>
 

Enumerations

enum  Error {
  Error::Success = 0, Error::Unknown, Error::Connection, Error::BindIPAddress,
  Error::Read, Error::Write, Error::ExceedRedirectCount, Error::Canceled,
  Error::SSLConnection, Error::SSLLoadingCerts, Error::SSLServerVerification, Error::UnsupportedMultipartBoundaryChars,
  Error::Compression, Error::ConnectionTimeout, Error::ProxyConnection, Error::SSLPeerCouldBeClosed_
}
 

Functions

void default_socket_options (socket_t sock)
 
const charstatus_message (int status)
 
std::string to_string (const 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 append_query_params (const std::string &path, const Params &params)
 
std::pair< std::string, std::string > make_range_header (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)
 

Typedef Documentation

◆ ContentProvider

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

Definition at line 424 of file httplib.h.

◆ ContentProviderResourceReleaser

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

Definition at line 428 of file httplib.h.

◆ ContentProviderWithoutLength

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

Definition at line 426 of file httplib.h.

◆ ContentReceiver

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

Definition at line 442 of file httplib.h.

◆ ContentReceiverWithProgress

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

Definition at line 440 of file httplib.h.

◆ Headers

using httplib::Headers = typedef std::multimap<std::string, std::string, detail::ci>

Definition at line 369 of file httplib.h.

◆ Logger

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

Definition at line 689 of file httplib.h.

◆ Match

using httplib::Match = typedef std::smatch

Definition at line 372 of file httplib.h.

◆ MultipartContentHeader

using httplib::MultipartContentHeader = typedef std::function<bool(const MultipartFormData& file)>

Definition at line 444 of file httplib.h.

◆ MultipartFormDataItems

using httplib::MultipartFormDataItems = typedef std::vector<MultipartFormData>

Definition at line 386 of file httplib.h.

◆ MultipartFormDataMap

using httplib::MultipartFormDataMap = typedef std::multimap<std::string, MultipartFormData>

Definition at line 387 of file httplib.h.

◆ MultipartFormDataProviderItems

Definition at line 437 of file httplib.h.

◆ Params

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

Definition at line 371 of file httplib.h.

◆ Progress

using httplib::Progress = typedef std::function<bool(uint64_t current, uint64_t total)>

Definition at line 374 of file httplib.h.

◆ Range

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

Definition at line 469 of file httplib.h.

◆ Ranges

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

Definition at line 470 of file httplib.h.

◆ ResponseHandler

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

Definition at line 377 of file httplib.h.

◆ SocketOptions

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

Definition at line 691 of file httplib.h.

Enumeration Type Documentation

◆ Error

enum httplib::Error
strong
Enumerator
Success 
Unknown 
Connection 
BindIPAddress 
Read 
Write 
ExceedRedirectCount 
Canceled 
SSLConnection 
SSLLoadingCerts 
SSLServerVerification 
UnsupportedMultipartBoundaryChars 
Compression 
ConnectionTimeout 
ProxyConnection 
SSLPeerCouldBeClosed_ 

Definition at line 955 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 5696 of file httplib.h.

◆ default_socket_options()

void httplib::default_socket_options ( socket_t  sock)
inline

Definition at line 1720 of file httplib.h.

◆ hosted_at() [1/2]

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

Definition at line 5653 of file httplib.h.

◆ hosted_at() [2/2]

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

Definition at line 5664 of file httplib.h.

◆ 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 5731 of file httplib.h.

◆ 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 5740 of file httplib.h.

◆ make_range_header()

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

Definition at line 5706 of file httplib.h.

◆ operator<<()

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

Definition at line 1858 of file httplib.h.

◆ status_message()

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

Definition at line 1736 of file httplib.h.

◆ to_string()

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

Definition at line 1832 of file httplib.h.