vendor : update cpp-httplib to 0.46.0 (#23650)
This commit is contained in:
parent
87b0a60cdd
commit
617255d437
Vendored
+40
-5
@@ -8,8 +8,8 @@
|
||||
#ifndef CPPHTTPLIB_HTTPLIB_H
|
||||
#define CPPHTTPLIB_HTTPLIB_H
|
||||
|
||||
#define CPPHTTPLIB_VERSION "0.45.1"
|
||||
#define CPPHTTPLIB_VERSION_NUM "0x002d01"
|
||||
#define CPPHTTPLIB_VERSION "0.46.0"
|
||||
#define CPPHTTPLIB_VERSION_NUM "0x002e00"
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0A00
|
||||
@@ -2024,6 +2024,31 @@ inline ssize_t read_body_content(Stream *stream, BodyReader &br, char *buf,
|
||||
|
||||
class decompressor;
|
||||
|
||||
enum class NoProxyKind {
|
||||
Wildcard, // "*"
|
||||
HostnameSuffix, // "example.com" or ".example.com"
|
||||
IPv4Cidr, // "10.0.0.0/8" (or single IP, treated as /32)
|
||||
IPv6Cidr, // "fe80::/10" (or single IP, treated as /128)
|
||||
};
|
||||
|
||||
// Unified 16-byte buffer holding either a v4 (first 4 bytes) or v6 address.
|
||||
// Lets one CIDR matcher cover both families.
|
||||
using IPBytes = std::array<uint8_t, 16>;
|
||||
|
||||
struct NoProxyEntry {
|
||||
NoProxyKind kind = NoProxyKind::Wildcard;
|
||||
std::string hostname_pattern; // lowercased, leading/trailing dot stripped
|
||||
IPBytes net{};
|
||||
int prefix_bits = 0;
|
||||
};
|
||||
|
||||
struct NormalizedTarget {
|
||||
std::string hostname; // lowercase; brackets and trailing dot removed
|
||||
bool is_ipv4 = false;
|
||||
bool is_ipv6 = false;
|
||||
IPBytes ip{};
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
class ClientImpl {
|
||||
@@ -2240,6 +2265,7 @@ public:
|
||||
void set_proxy_basic_auth(const std::string &username,
|
||||
const std::string &password);
|
||||
void set_proxy_bearer_token_auth(const std::string &token);
|
||||
void set_no_proxy(const std::vector<std::string> &patterns);
|
||||
|
||||
void set_logger(Logger logger);
|
||||
void set_error_logger(ErrorLogger error_logger);
|
||||
@@ -2265,16 +2291,19 @@ protected:
|
||||
std::chrono::time_point<std::chrono::steady_clock> start_time,
|
||||
Response &res, bool &success, Error &error);
|
||||
|
||||
bool is_proxy_enabled_for_host(const std::string &host) const;
|
||||
|
||||
// All of:
|
||||
// shutdown_ssl
|
||||
// shutdown_socket
|
||||
// close_socket
|
||||
// should ONLY be called when socket_mutex_ is locked.
|
||||
// Also, shutdown_ssl and close_socket should also NOT be called concurrently
|
||||
// with a DIFFERENT thread sending requests using that socket.
|
||||
// disconnect
|
||||
// should ONLY be called when socket_mutex_ is locked, and only when
|
||||
// no other thread is using the socket.
|
||||
virtual void shutdown_ssl(Socket &socket, bool shutdown_gracefully);
|
||||
void shutdown_socket(Socket &socket) const;
|
||||
void close_socket(Socket &socket);
|
||||
void disconnect(bool gracefully);
|
||||
|
||||
bool process_request(Stream &strm, Request &req, Response &res,
|
||||
bool close_connection, Error &error);
|
||||
@@ -2352,6 +2381,11 @@ protected:
|
||||
std::string proxy_basic_auth_password_;
|
||||
std::string proxy_bearer_token_auth_token_;
|
||||
|
||||
std::vector<detail::NoProxyEntry> no_proxy_entries_;
|
||||
|
||||
mutable detail::NormalizedTarget host_normalized_;
|
||||
mutable bool host_normalized_valid_ = false;
|
||||
|
||||
mutable std::mutex logger_mutex_;
|
||||
Logger logger_;
|
||||
ErrorLogger error_logger_;
|
||||
@@ -2612,6 +2646,7 @@ public:
|
||||
void set_proxy_basic_auth(const std::string &username,
|
||||
const std::string &password);
|
||||
void set_proxy_bearer_token_auth(const std::string &token);
|
||||
void set_no_proxy(const std::vector<std::string> &patterns);
|
||||
void set_logger(Logger logger);
|
||||
void set_error_logger(ErrorLogger error_logger);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user