D++ (DPP)
C++ Discord API Bot Library
httplib::detail Namespace Reference

Namespaces

namespace  udl
 

Classes

class  BufferStream
 
struct  ci
 
class  compressor
 
class  ContentProviderAdapter
 
class  decompressor
 
class  MultipartFormDataParser
 
class  nocompressor
 
class  SocketStream
 
class  stream_line_reader
 

Enumerations

enum class  EncodingType { None = 0 , Gzip , Brotli }
 

Functions

template<class T , class... Args>
std::enable_if<!std::is_array< T >::value, std::unique_ptr< T > >::type make_unique (Args &&... args)
 
template<class T >
std::enable_if< std::is_array< T >::value, std::unique_ptr< T > >::type make_unique (std::size_t n)
 
bool is_hex (char c, int &v)
 
bool from_hex_to_i (const std::string &s, size_t i, size_t cnt, int &val)
 
std::string from_i_to_hex (size_t n)
 
size_t to_utf8 (int code, char *buff)
 
std::string base64_encode (const std::string &in)
 
bool is_file (const std::string &path)
 
bool is_dir (const std::string &path)
 
bool is_valid_path (const std::string &path)
 
std::string encode_query_param (const std::string &value)
 
std::string encode_url (const std::string &s)
 
std::string decode_url (const std::string &s, bool convert_plus_to_space)
 
void read_file (const std::string &path, std::string &out)
 
std::string file_extension (const std::string &path)
 
bool is_space_or_tab (char c)
 
std::pair< size_t, size_t > trim (const char *b, const char *e, size_t left, size_t right)
 
std::string trim_copy (const std::string &s)
 
template<class Fn >
void split (const char *b, const char *e, char d, Fn fn)
 
int close_socket (socket_t sock)
 
template<typename T >
ssize_t handle_EINTR (T fn)
 
ssize_t select_read (socket_t sock, time_t sec, time_t usec)
 
ssize_t select_write (socket_t sock, time_t sec, time_t usec)
 
bool wait_until_socket_is_ready (socket_t sock, time_t sec, time_t usec)
 
bool keep_alive (socket_t sock, time_t keep_alive_timeout_sec)
 
template<typename T >
bool process_server_socket_core (socket_t sock, size_t keep_alive_max_count, time_t keep_alive_timeout_sec, T callback)
 
template<typename T >
bool process_server_socket (socket_t sock, size_t keep_alive_max_count, time_t keep_alive_timeout_sec, time_t read_timeout_sec, time_t read_timeout_usec, time_t write_timeout_sec, time_t write_timeout_usec, T callback)
 
template<typename T >
bool process_client_socket (socket_t sock, time_t read_timeout_sec, time_t read_timeout_usec, time_t write_timeout_sec, time_t write_timeout_usec, T callback)
 
int shutdown_socket (socket_t sock)
 
template<typename BindOrConnect >
socket_t create_socket (const char *host, int port, int socket_flags, bool tcp_nodelay, SocketOptions socket_options, BindOrConnect bind_or_connect)
 
void set_nonblocking (socket_t sock, bool nonblocking)
 
bool is_connection_error ()
 
bool bind_ip_address (socket_t sock, const char *host)
 
std::string if2ip (const std::string &ifn)
 
socket_t create_client_socket (const char *host, int port, bool tcp_nodelay, SocketOptions socket_options, time_t timeout_sec, time_t timeout_usec, const std::string &intf, Error &error)
 
void get_remote_ip_and_port (const struct sockaddr_storage &addr, socklen_t addr_len, std::string &ip, int &port)
 
void get_remote_ip_and_port (socket_t sock, std::string &ip, int &port)
 
constexpr unsigned int str2tag_core (const char *s, size_t l, unsigned int h)
 
unsigned int str2tag (const std::string &s)
 
const char * find_content_type (const std::string &path, const std::map< std::string, std::string > &user_data)
 
const char * status_message (int status)
 
bool can_compress_content_type (const std::string &content_type)
 
EncodingType encoding_type (const Request &req, const Response &res)
 
bool has_header (const Headers &headers, const char *key)
 
const char * get_header_value (const Headers &headers, const char *key, size_t id=0, const char *def=nullptr)
 
template<typename T >
get_header_value (const Headers &, const char *, size_t=0, uint64_t=0)
 
template<>
uint64_t get_header_value< uint64_t > (const Headers &headers, const char *key, size_t id, uint64_t def)
 
template<typename T >
bool parse_header (const char *beg, const char *end, T fn)
 
bool read_headers (Stream &strm, Headers &headers)
 
bool read_content_with_length (Stream &strm, uint64_t len, Progress progress, ContentReceiverWithProgress out)
 
void skip_content_with_length (Stream &strm, uint64_t len)
 
bool read_content_without_length (Stream &strm, ContentReceiverWithProgress out)
 
bool read_content_chunked (Stream &strm, ContentReceiverWithProgress out)
 
bool is_chunked_transfer_encoding (const Headers &headers)
 
template<typename T , typename U >
bool prepare_content_receiver (T &x, int &status, ContentReceiverWithProgress receiver, bool decompress, U callback)
 
template<typename T >
bool read_content (Stream &strm, T &x, size_t payload_max_length, int &status, Progress progress, ContentReceiverWithProgress receiver, bool decompress)
 
ssize_t write_headers (Stream &strm, const Headers &headers)
 
bool write_data (Stream &strm, const char *d, size_t l)
 
template<typename T >
bool write_content (Stream &strm, const ContentProvider &content_provider, size_t offset, size_t length, T is_shutting_down, Error &error)
 
template<typename T >
bool write_content (Stream &strm, const ContentProvider &content_provider, size_t offset, size_t length, const T &is_shutting_down)
 
template<typename T >
bool write_content_without_length (Stream &strm, const ContentProvider &content_provider, const T &is_shutting_down)
 
template<typename T , typename U >
bool write_content_chunked (Stream &strm, const ContentProvider &content_provider, const T &is_shutting_down, U &compressor, Error &error)
 
template<typename T , typename U >
bool write_content_chunked (Stream &strm, const ContentProvider &content_provider, const T &is_shutting_down, U &compressor)
 
template<typename T >
bool redirect (T &cli, Request &req, Response &res, const std::string &path, const std::string &location, Error &error)
 
std::string params_to_query_str (const Params &params)
 
std::string append_query_params (const char *path, const Params &params)
 
void parse_query_text (const std::string &s, Params &params)
 
bool parse_multipart_boundary (const std::string &content_type, std::string &boundary)
 
bool parse_range_header (const std::string &s, Ranges &ranges)
 
std::string to_lower (const char *beg, const char *end)
 
std::string make_multipart_data_boundary ()
 
std::pair< size_t, size_t > get_range_offset_and_length (const Request &req, size_t content_length, size_t index)
 
std::string make_content_range_header_field (size_t offset, size_t length, size_t content_length)
 
template<typename SToken , typename CToken , typename Content >
bool process_multipart_ranges_data (const Request &req, Response &res, const std::string &boundary, const std::string &content_type, SToken stoken, CToken ctoken, Content content)
 
bool make_multipart_ranges_data (const Request &req, Response &res, const std::string &boundary, const std::string &content_type, std::string &data)
 
size_t get_multipart_ranges_data_length (const Request &req, Response &res, const std::string &boundary, const std::string &content_type)
 
template<typename T >
bool write_multipart_ranges_data (Stream &strm, const Request &req, Response &res, const std::string &boundary, const std::string &content_type, const T &is_shutting_down)
 
std::pair< size_t, size_t > get_range_offset_and_length (const Request &req, const Response &res, size_t index)
 
bool expect_content (const Request &req)
 
bool has_crlf (const char *s)
 
bool parse_www_authenticate (const Response &res, std::map< std::string, std::string > &auth, bool is_proxy)
 
std::string random_string (size_t length)
 

Enumeration Type Documentation

◆ EncodingType

enum class httplib::detail::EncodingType
strong
Enumerator
None 
Gzip 
Brotli 

Function Documentation

◆ append_query_params()

std::string httplib::detail::append_query_params ( const char *  path,
const Params params 
)
inline

◆ base64_encode()

std::string httplib::detail::base64_encode ( const std::string &  in)
inline

◆ bind_ip_address()

bool httplib::detail::bind_ip_address ( socket_t  sock,
const char *  host 
)
inline

◆ can_compress_content_type()

bool httplib::detail::can_compress_content_type ( const std::string &  content_type)
inline

◆ close_socket()

int httplib::detail::close_socket ( socket_t  sock)
inline

◆ create_client_socket()

socket_t httplib::detail::create_client_socket ( const char *  host,
int  port,
bool  tcp_nodelay,
SocketOptions  socket_options,
time_t  timeout_sec,
time_t  timeout_usec,
const std::string &  intf,
Error error 
)
inline

◆ create_socket()

template<typename BindOrConnect >
socket_t httplib::detail::create_socket ( const char *  host,
int  port,
int  socket_flags,
bool  tcp_nodelay,
SocketOptions  socket_options,
BindOrConnect  bind_or_connect 
)

◆ decode_url()

std::string httplib::detail::decode_url ( const std::string &  s,
bool  convert_plus_to_space 
)
inline

◆ encode_query_param()

std::string httplib::detail::encode_query_param ( const std::string &  value)
inline

◆ encode_url()

std::string httplib::detail::encode_url ( const std::string &  s)
inline

◆ encoding_type()

EncodingType httplib::detail::encoding_type ( const Request req,
const Response res 
)
inline

◆ expect_content()

bool httplib::detail::expect_content ( const Request req)
inline

◆ file_extension()

std::string httplib::detail::file_extension ( const std::string &  path)
inline

◆ find_content_type()

const char * httplib::detail::find_content_type ( const std::string &  path,
const std::map< std::string, std::string > &  user_data 
)
inline

◆ from_hex_to_i()

bool httplib::detail::from_hex_to_i ( const std::string &  s,
size_t  i,
size_t  cnt,
int &  val 
)
inline

◆ from_i_to_hex()

std::string httplib::detail::from_i_to_hex ( size_t  n)
inline

◆ get_header_value() [1/2]

template<typename T >
T httplib::detail::get_header_value ( const Headers ,
const char *  ,
size_t  = 0,
uint64_t  = 0 
)
inline

◆ get_header_value() [2/2]

const char * httplib::detail::get_header_value ( const Headers headers,
const char *  key,
size_t  id = 0,
const char *  def = nullptr 
)
inline

◆ get_header_value< uint64_t >()

template<>
uint64_t httplib::detail::get_header_value< uint64_t > ( const Headers headers,
const char *  key,
size_t  id,
uint64_t  def 
)
inline

◆ get_multipart_ranges_data_length()

size_t httplib::detail::get_multipart_ranges_data_length ( const Request req,
Response res,
const std::string &  boundary,
const std::string &  content_type 
)
inline

◆ get_range_offset_and_length() [1/2]

std::pair< size_t, size_t > httplib::detail::get_range_offset_and_length ( const Request req,
const Response res,
size_t  index 
)
inline

◆ get_range_offset_and_length() [2/2]

std::pair< size_t, size_t > httplib::detail::get_range_offset_and_length ( const Request req,
size_t  content_length,
size_t  index 
)
inline

◆ get_remote_ip_and_port() [1/2]

void httplib::detail::get_remote_ip_and_port ( const struct sockaddr_storage &  addr,
socklen_t  addr_len,
std::string &  ip,
int &  port 
)
inline

◆ get_remote_ip_and_port() [2/2]

void httplib::detail::get_remote_ip_and_port ( socket_t  sock,
std::string &  ip,
int &  port 
)
inline

◆ handle_EINTR()

template<typename T >
ssize_t httplib::detail::handle_EINTR ( fn)
inline

◆ has_crlf()

bool httplib::detail::has_crlf ( const char *  s)
inline

◆ has_header()

bool httplib::detail::has_header ( const Headers headers,
const char *  key 
)
inline

◆ if2ip()

std::string httplib::detail::if2ip ( const std::string &  ifn)
inline

◆ is_chunked_transfer_encoding()

bool httplib::detail::is_chunked_transfer_encoding ( const Headers headers)
inline

◆ is_connection_error()

bool httplib::detail::is_connection_error ( )
inline

◆ is_dir()

bool httplib::detail::is_dir ( const std::string &  path)
inline

◆ is_file()

bool httplib::detail::is_file ( const std::string &  path)
inline

◆ is_hex()

bool httplib::detail::is_hex ( char  c,
int &  v 
)
inline

◆ is_space_or_tab()

bool httplib::detail::is_space_or_tab ( char  c)
inline

◆ is_valid_path()

bool httplib::detail::is_valid_path ( const std::string &  path)
inline

◆ keep_alive()

bool httplib::detail::keep_alive ( socket_t  sock,
time_t  keep_alive_timeout_sec 
)
inline

◆ make_content_range_header_field()

std::string httplib::detail::make_content_range_header_field ( size_t  offset,
size_t  length,
size_t  content_length 
)
inline

◆ make_multipart_data_boundary()

std::string httplib::detail::make_multipart_data_boundary ( )
inline

◆ make_multipart_ranges_data()

bool httplib::detail::make_multipart_ranges_data ( const Request req,
Response res,
const std::string &  boundary,
const std::string &  content_type,
std::string &  data 
)
inline

◆ make_unique() [1/2]

template<class T , class... Args>
std::enable_if<!std::is_array< T >::value, std::unique_ptr< T > >::type httplib::detail::make_unique ( Args &&...  args)

◆ make_unique() [2/2]

template<class T >
std::enable_if< std::is_array< T >::value, std::unique_ptr< T > >::type httplib::detail::make_unique ( std::size_t  n)

◆ params_to_query_str()

std::string httplib::detail::params_to_query_str ( const Params params)
inline

◆ parse_header()

template<typename T >
bool httplib::detail::parse_header ( const char *  beg,
const char *  end,
fn 
)
inline

◆ parse_multipart_boundary()

bool httplib::detail::parse_multipart_boundary ( const std::string &  content_type,
std::string &  boundary 
)
inline

◆ parse_query_text()

void httplib::detail::parse_query_text ( const std::string &  s,
Params params 
)
inline

◆ parse_range_header()

bool httplib::detail::parse_range_header ( const std::string &  s,
Ranges ranges 
)
inline

◆ parse_www_authenticate()

bool httplib::detail::parse_www_authenticate ( const Response res,
std::map< std::string, std::string > &  auth,
bool  is_proxy 
)
inline

◆ prepare_content_receiver()

template<typename T , typename U >
bool httplib::detail::prepare_content_receiver ( T &  x,
int &  status,
ContentReceiverWithProgress  receiver,
bool  decompress,
callback 
)

◆ process_client_socket()

template<typename T >
bool httplib::detail::process_client_socket ( socket_t  sock,
time_t  read_timeout_sec,
time_t  read_timeout_usec,
time_t  write_timeout_sec,
time_t  write_timeout_usec,
callback 
)
inline

◆ process_multipart_ranges_data()

template<typename SToken , typename CToken , typename Content >
bool httplib::detail::process_multipart_ranges_data ( const Request req,
Response res,
const std::string &  boundary,
const std::string &  content_type,
SToken  stoken,
CToken  ctoken,
Content  content 
)

◆ process_server_socket()

template<typename T >
bool httplib::detail::process_server_socket ( socket_t  sock,
size_t  keep_alive_max_count,
time_t  keep_alive_timeout_sec,
time_t  read_timeout_sec,
time_t  read_timeout_usec,
time_t  write_timeout_sec,
time_t  write_timeout_usec,
callback 
)
inline

◆ process_server_socket_core()

template<typename T >
bool httplib::detail::process_server_socket_core ( socket_t  sock,
size_t  keep_alive_max_count,
time_t  keep_alive_timeout_sec,
callback 
)
inline

◆ random_string()

std::string httplib::detail::random_string ( size_t  length)
inline

◆ read_content()

template<typename T >
bool httplib::detail::read_content ( Stream strm,
T &  x,
size_t  payload_max_length,
int &  status,
Progress  progress,
ContentReceiverWithProgress  receiver,
bool  decompress 
)

◆ read_content_chunked()

bool httplib::detail::read_content_chunked ( Stream strm,
ContentReceiverWithProgress  out 
)
inline

◆ read_content_with_length()

bool httplib::detail::read_content_with_length ( Stream strm,
uint64_t  len,
Progress  progress,
ContentReceiverWithProgress  out 
)
inline

◆ read_content_without_length()

bool httplib::detail::read_content_without_length ( Stream strm,
ContentReceiverWithProgress  out 
)
inline

◆ read_file()

void httplib::detail::read_file ( const std::string &  path,
std::string &  out 
)
inline

◆ read_headers()

bool httplib::detail::read_headers ( Stream strm,
Headers headers 
)
inline

◆ redirect()

template<typename T >
bool httplib::detail::redirect ( T &  cli,
Request req,
Response res,
const std::string &  path,
const std::string &  location,
Error error 
)
inline

◆ select_read()

ssize_t httplib::detail::select_read ( socket_t  sock,
time_t  sec,
time_t  usec 
)
inline

◆ select_write()

ssize_t httplib::detail::select_write ( socket_t  sock,
time_t  sec,
time_t  usec 
)
inline

◆ set_nonblocking()

void httplib::detail::set_nonblocking ( socket_t  sock,
bool  nonblocking 
)
inline

◆ shutdown_socket()

int httplib::detail::shutdown_socket ( socket_t  sock)
inline

◆ skip_content_with_length()

void httplib::detail::skip_content_with_length ( Stream strm,
uint64_t  len 
)
inline

◆ split()

template<class Fn >
void httplib::detail::split ( const char *  b,
const char *  e,
char  d,
Fn  fn 
)

◆ status_message()

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

◆ str2tag()

unsigned int httplib::detail::str2tag ( const std::string &  s)
inline

◆ str2tag_core()

constexpr unsigned int httplib::detail::str2tag_core ( const char *  s,
size_t  l,
unsigned int  h 
)
inlineconstexpr

◆ to_lower()

std::string httplib::detail::to_lower ( const char *  beg,
const char *  end 
)
inline

◆ to_utf8()

size_t httplib::detail::to_utf8 ( int  code,
char *  buff 
)
inline

◆ trim()

std::pair< size_t, size_t > httplib::detail::trim ( const char *  b,
const char *  e,
size_t  left,
size_t  right 
)
inline

◆ trim_copy()

std::string httplib::detail::trim_copy ( const std::string &  s)
inline

◆ wait_until_socket_is_ready()

bool httplib::detail::wait_until_socket_is_ready ( socket_t  sock,
time_t  sec,
time_t  usec 
)
inline

◆ write_content() [1/2]

template<typename T >
bool httplib::detail::write_content ( Stream strm,
const ContentProvider content_provider,
size_t  offset,
size_t  length,
const T &  is_shutting_down 
)
inline

◆ write_content() [2/2]

template<typename T >
bool httplib::detail::write_content ( Stream strm,
const ContentProvider content_provider,
size_t  offset,
size_t  length,
is_shutting_down,
Error error 
)
inline

◆ write_content_chunked() [1/2]

template<typename T , typename U >
bool httplib::detail::write_content_chunked ( Stream strm,
const ContentProvider content_provider,
const T &  is_shutting_down,
U &  compressor 
)
inline

◆ write_content_chunked() [2/2]

template<typename T , typename U >
bool httplib::detail::write_content_chunked ( Stream strm,
const ContentProvider content_provider,
const T &  is_shutting_down,
U &  compressor,
Error error 
)
inline

◆ write_content_without_length()

template<typename T >
bool httplib::detail::write_content_without_length ( Stream strm,
const ContentProvider content_provider,
const T &  is_shutting_down 
)
inline

◆ write_data()

bool httplib::detail::write_data ( Stream strm,
const char *  d,
size_t  l 
)
inline

◆ write_headers()

ssize_t httplib::detail::write_headers ( Stream strm,
const Headers headers 
)
inline

◆ write_multipart_ranges_data()

template<typename T >
bool httplib::detail::write_multipart_ranges_data ( Stream strm,
const Request req,
Response res,
const std::string &  boundary,
const std::string &  content_type,
const T &  is_shutting_down 
)
inline
D++ Library version 10.1.2D++ Library version 10.1.1D++ Library version 10.1.0D++ Library version 10.0.35D++ Library version 10.0.34D++ Library version 10.0.33D++ Library version 10.0.32D++ Library version 10.0.31D++ Library version 10.0.30D++ Library version 10.0.29D++ Library version 10.0.28D++ Library version 10.0.27D++ Library version 10.0.26D++ Library version 10.0.25D++ Library version 10.0.24D++ Library version 10.0.23D++ Library version 10.0.22D++ Library version 10.0.21D++ Library version 10.0.20D++ Library version 10.0.19D++ Library version 10.0.18D++ Library version 10.0.17D++ Library version 10.0.16D++ Library version 10.0.15D++ Library version 10.0.14D++ Library version 10.0.13D++ Library version 10.0.12D++ Library version 10.0.11D++ Library version 10.0.10D++ Library version 10.0.9D++ Library version 10.0.8D++ Library version 10.0.7D++ Library version 10.0.6D++ Library version 10.0.5D++ Library version 10.0.4D++ Library version 10.0.3D++ Library version 10.0.2D++ Library version 10.0.1D++ Library version 10.0.0D++ Library version 9.0.19D++ Library version 9.0.18D++ Library version 9.0.17D++ Library version 9.0.16D++ Library version 9.0.15D++ Library version 9.0.14D++ Library version 9.0.13D++ Library version 9.0.12D++ Library version 9.0.11D++ Library version 9.0.10D++ Library version 9.0.9D++ Library version 9.0.8D++ Library version 9.0.7D++ Library version 9.0.6D++ Library version 9.0.5D++ Library version 9.0.4D++ Library version 9.0.3D++ Library version 9.0.2D++ Library version 9.0.1D++ Library version 9.0.0D++ Library version 1.0.2D++ Library version 1.0.1D++ Library version 1.0.0