vendor: update cpp-httplib to 0.66.0 (#32049)

This commit is contained in:
Alessandro de Oliveira Faria (A.K.A.CABELO) authored and GitHub committed 2026-11-11 20:07:30 +08:00
1 parent 2e325dcd57
commit b8abe41a50
3 files changed
+39 -9

No files matched your search

+1 -1
View File
@@ -5,7 +5,7 @@ import os
import sys
import subprocess
HTTPLIB_VERSION = "refs/tags/v0.65.0"
HTTPLIB_VERSION = "refs/tags/v0.66.0"
# used by examples/gguf-hash, these repos have no release tag, so we pin a commit
XXHASH_COMMIT = "9f465f1ea932d6ad9a26cd77496311ffa544cd68"
+36 -6
View File
@@ -7703,7 +7703,16 @@ bool ThreadPool::enqueue(std::function<void()> fn) {
if (jobs_.size() > idle_thread_count_ &&
threads_.size() + dynamic_threads_.size() < max_thread_count_) {
cleanup_finished_threads();
dynamic_threads_.emplace_back(std::thread([this]() { worker(true); }));
#ifndef CPPHTTPLIB_NO_EXCEPTIONS
try {
#endif
dynamic_threads_.emplace_back(std::thread([this]() { worker(true); }));
#ifndef CPPHTTPLIB_NO_EXCEPTIONS
} catch (const std::system_error &) {
// No thread budget left: keep the job queued for an existing worker
// instead of letting the exception escape the accept loop.
}
#endif
}
}
@@ -8158,14 +8167,22 @@ make_host_and_port_string_always_port(const std::string &host, int port) {
return prepare_host_string(host) + ":" + std::to_string(port);
}
// Where a client connects for `host`, as one string: the mapped address or
// name, or `host` itself.
std::string
addr_map_target(const std::map<std::string, std::string> &addr_map,
const std::string &host) {
std::string connect_host;
std::string ip;
apply_addr_map(addr_map, host, connect_host, ip);
return ip.empty() ? connect_host : ip;
}
// Request target of a CONNECT for `host`, with `addr_map` applied.
std::string
make_connect_request_target(const std::map<std::string, std::string> &addr_map,
const std::string &host, int port) {
std::string connect_host;
std::string ip;
apply_addr_map(addr_map, host, connect_host, ip);
return make_host_and_port_string_always_port(ip.empty() ? connect_host : ip,
return make_host_and_port_string_always_port(addr_map_target(addr_map, host),
port);
}
@@ -11553,8 +11570,13 @@ bool ClientImpl::redirect(Request &req, Response &res, Error &error) {
auto path = std::move(next_path) + next_query;
// A Unix socket client sends "Host: localhost", so a Location naming
// localhost names this client too.
auto is_same_host = next_host == host_ ||
(address_family_ == AF_UNIX && next_host == "localhost");
// Same host redirect - use current client
if (next_scheme == scheme && next_host == host_ && next_port == port_) {
if (next_scheme == scheme && is_same_host && next_port == port_) {
return detail::redirect(*this, req, res, path, location, error);
}
@@ -11705,6 +11727,14 @@ void ClientImpl::setup_redirect_client(ClientType &client) {
// Copy network and socket settings
client.addr_map_ = addr_map_;
client.tunnel_addr_map_ = tunnel_addr_map_;
// A Unix socket client reaches every host through its own socket, as curl's
// --unix-socket does, unless the caller mapped that host elsewhere. The
// Location's host is never taken as a socket path.
if (address_family_ == AF_UNIX) {
auto &target = client.addr_map_[client.host()];
if (target.empty()) { target = detail::addr_map_target(addr_map_, host_); }
}
client.set_address_family(address_family_);
client.set_tcp_nodelay(tcp_nodelay_);
client.set_ipv6_v6only(ipv6_v6only_);
+2 -2
View File
@@ -8,8 +8,8 @@
#ifndef CPPHTTPLIB_HTTPLIB_H
#define CPPHTTPLIB_HTTPLIB_H
#define CPPHTTPLIB_VERSION "0.65.0"
#define CPPHTTPLIB_VERSION_NUM "0x004100"
#define CPPHTTPLIB_VERSION "0.66.0"
#define CPPHTTPLIB_VERSION_NUM "0x004200"
#ifdef _WIN32
#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0A00