vendor : update cpp-httplib to 0.30.1 (#18771)

Signed-off-by: Adrien Gallouët <angt@huggingface.co>
This commit is contained in:
Adrien Gallouët
2026-01-12 15:58:52 +01:00
committed by GitHub
parent 4150da9a95
commit 8e649571cd
3 changed files with 25 additions and 20 deletions
+2 -2
View File
@@ -16,8 +16,8 @@ vendor = {
# "https://github.com/mackron/miniaudio/raw/refs/tags/0.11.23/miniaudio.h": "vendor/miniaudio/miniaudio.h", # "https://github.com/mackron/miniaudio/raw/refs/tags/0.11.23/miniaudio.h": "vendor/miniaudio/miniaudio.h",
"https://github.com/mackron/miniaudio/raw/669ed3e844524fcd883231b13095baee9f6de304/miniaudio.h": "vendor/miniaudio/miniaudio.h", "https://github.com/mackron/miniaudio/raw/669ed3e844524fcd883231b13095baee9f6de304/miniaudio.h": "vendor/miniaudio/miniaudio.h",
"https://raw.githubusercontent.com/yhirose/cpp-httplib/refs/tags/v0.30.0/httplib.h": "vendor/cpp-httplib/httplib.h", "https://raw.githubusercontent.com/yhirose/cpp-httplib/refs/tags/v0.30.1/httplib.h": "vendor/cpp-httplib/httplib.h",
"https://raw.githubusercontent.com/yhirose/cpp-httplib/refs/tags/v0.30.0/LICENSE": "vendor/cpp-httplib/LICENSE", "https://raw.githubusercontent.com/yhirose/cpp-httplib/refs/tags/v0.30.1/LICENSE": "vendor/cpp-httplib/LICENSE",
"https://raw.githubusercontent.com/sheredom/subprocess.h/b49c56e9fe214488493021017bf3954b91c7c1f5/subprocess.h": "vendor/sheredom/subprocess.h", "https://raw.githubusercontent.com/sheredom/subprocess.h/b49c56e9fe214488493021017bf3954b91c7c1f5/subprocess.h": "vendor/sheredom/subprocess.h",
} }
+6 -8
View File
@@ -1138,6 +1138,7 @@ int getaddrinfo_with_timeout(const char *node, const char *service,
return ret; return ret;
#elif TARGET_OS_MAC #elif TARGET_OS_MAC
if (!node) { return EAI_NONAME; }
// macOS implementation using CFHost API for asynchronous DNS resolution // macOS implementation using CFHost API for asynchronous DNS resolution
CFStringRef hostname_ref = CFStringCreateWithCString( CFStringRef hostname_ref = CFStringCreateWithCString(
kCFAllocatorDefault, node, kCFStringEncodingUTF8); kCFAllocatorDefault, node, kCFStringEncodingUTF8);
@@ -5569,14 +5570,11 @@ bool Server::read_content(Stream &strm, Request &req, Response &res) {
strm, req, res, strm, req, res,
// Regular // Regular
[&](const char *buf, size_t n) { [&](const char *buf, size_t n) {
// Prevent arithmetic overflow when checking sizes. // Limit decompressed body size to payload_max_length_ to protect
// Avoid computing (req.body.size() + n) directly because // against "zip bomb" attacks where a small compressed payload
// adding two unsigned `size_t` values can wrap around and // decompresses to a massive size.
// produce a small result instead of indicating overflow. if (req.body.size() + n > payload_max_length_ ||
// Instead, check using subtraction: ensure `n` does not req.body.size() + n > req.body.max_size()) {
// exceed the remaining capacity `max_size() - size()`.
if (req.body.size() >= req.body.max_size() ||
n > req.body.max_size() - req.body.size()) {
return false; return false;
} }
req.body.append(buf, n); req.body.append(buf, n);
+12 -5
View File
@@ -8,8 +8,8 @@
#ifndef CPPHTTPLIB_HTTPLIB_H #ifndef CPPHTTPLIB_HTTPLIB_H
#define CPPHTTPLIB_HTTPLIB_H #define CPPHTTPLIB_HTTPLIB_H
#define CPPHTTPLIB_VERSION "0.30.0" #define CPPHTTPLIB_VERSION "0.30.1"
#define CPPHTTPLIB_VERSION_NUM "0x001E00" #define CPPHTTPLIB_VERSION_NUM "0x001E01"
/* /*
* Platform compatibility check * Platform compatibility check
@@ -205,7 +205,10 @@
#pragma comment(lib, "ws2_32.lib") #pragma comment(lib, "ws2_32.lib")
#ifndef _SSIZE_T_DEFINED
using ssize_t = __int64; using ssize_t = __int64;
#define _SSIZE_T_DEFINED
#endif
#endif // _MSC_VER #endif // _MSC_VER
#ifndef S_ISREG #ifndef S_ISREG
@@ -2443,16 +2446,20 @@ namespace detail {
#if defined(_WIN32) #if defined(_WIN32)
inline std::wstring u8string_to_wstring(const char *s) { inline std::wstring u8string_to_wstring(const char *s) {
std::wstring ws; if (!s) { return std::wstring(); }
auto len = static_cast<int>(strlen(s)); auto len = static_cast<int>(strlen(s));
if (!len) { return std::wstring(); }
auto wlen = ::MultiByteToWideChar(CP_UTF8, 0, s, len, nullptr, 0); auto wlen = ::MultiByteToWideChar(CP_UTF8, 0, s, len, nullptr, 0);
if (wlen > 0) { if (!wlen) { return std::wstring(); }
std::wstring ws;
ws.resize(wlen); ws.resize(wlen);
wlen = ::MultiByteToWideChar( wlen = ::MultiByteToWideChar(
CP_UTF8, 0, s, len, CP_UTF8, 0, s, len,
const_cast<LPWSTR>(reinterpret_cast<LPCWSTR>(ws.data())), wlen); const_cast<LPWSTR>(reinterpret_cast<LPCWSTR>(ws.data())), wlen);
if (wlen != static_cast<int>(ws.size())) { ws.clear(); } if (wlen != static_cast<int>(ws.size())) { ws.clear(); }
}
return ws; return ws;
} }
#endif #endif