Merge branch 'upstream' into concedo_experimental

# Conflicts:
#	docs/backend/SYCL.md
#	docs/backend/snapdragon/developer.md
#	examples/convert-llama2c-to-ggml/convert-llama2c-to-ggml.cpp
#	examples/sycl/run-llama2.sh
#	examples/sycl/start-svr.sh
#	examples/sycl/test.sh
#	examples/sycl/win-run-llama2.bat
#	examples/sycl/win-start-svr.bat
#	examples/sycl/win-test.bat
#	ggml/CMakeLists.txt
#	ggml/src/ggml-et/et-kernels/src/ssm_scan_f32.c
#	ggml/src/ggml-et/ggml-et-ops.cpp
#	ggml/src/ggml-et/ggml-et-ops.h
#	ggml/src/ggml-sycl/ssm_scan.cpp
#	ggml/src/ggml-webgpu/ggml-webgpu.cpp
#	ggml/src/ggml-webgpu/wgsl-shaders/ssm_scan.wgsl
#	scripts/bench-models.sh
#	scripts/snapdragon/adb/run-bench.sh
#	scripts/snapdragon/adb/run-cli.sh
#	scripts/snapdragon/adb/run-completion.sh
#	scripts/snapdragon/adb/run-mtmd.sh
#	scripts/snapdragon/windows/run-bench.ps1
#	scripts/snapdragon/windows/run-cli.ps1
#	scripts/snapdragon/windows/run-completion.ps1
#	scripts/snapdragon/windows/run-mtmd.ps1
#	scripts/sync-ggml.last
#	scripts/sync_vendor.py
#	tests/CMakeLists.txt
#	tests/test-backend-ops.cpp
#	tests/test-chat.cpp
#	tests/test-jinja.cpp
#	tests/test-llama-archs.cpp
#	tools/cli/README.md
#	tools/completion/README.md
#	tools/llama-bench/README.md
#	tools/server/README.md
This commit is contained in:
Concedo
2026-08-15 22:50:04 +08:00
60 changed files with 1781 additions and 447 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ if (LLAMA_BUILD_BORINGSSL)
set(FIPS OFF CACHE BOOL "Enable FIPS (BoringSSL)")
set(BORINGSSL_GIT "https://boringssl.googlesource.com/boringssl" CACHE STRING "BoringSSL git repository")
set(BORINGSSL_VERSION "0.20260803.0" CACHE STRING "BoringSSL version")
set(BORINGSSL_VERSION "0.20260813.0" CACHE STRING "BoringSSL version")
message(STATUS "Fetching BoringSSL version ${BORINGSSL_VERSION}")
+27 -11
View File
@@ -7146,6 +7146,10 @@ PathParamsMatcher::PathParamsMatcher(const std::string &pattern)
bool PathParamsMatcher::match(Request &request) const {
request.matches = std::smatch();
request.path_params.clear();
// A pattern without parameters is just a literal path to compare against
if (param_names_.empty()) { return request.path == pattern(); }
request.path_params.reserve(param_names_.size());
// One past the position at which the path matched the pattern last time
@@ -7188,6 +7192,11 @@ bool PathParamsMatcher::match(Request &request) const {
bool RegexMatcher::match(Request &request) const {
request.path_params.clear();
// See CPPHTTPLIB_REGEX_ROUTE_PATH_MAX_LENGTH: an overlong path is treated as
// a non-match rather than risking a stack overflow in std::regex_match.
if (request.path.length() > CPPHTTPLIB_REGEX_ROUTE_PATH_MAX_LENGTH) {
return false;
}
return std::regex_match(request.path, request.matches, regex_);
}
@@ -7613,11 +7622,21 @@ Server::~Server() = default;
std::unique_ptr<detail::MatcherBase>
Server::make_matcher(const std::string &pattern) {
// Path params take precedence, so "/users/:id/(.*)" keeps being matched as
// a path params pattern
if (pattern.find("/:") != std::string::npos) {
return detail::make_unique<detail::PathParamsMatcher>(pattern);
} else {
return detail::make_unique<detail::RegexMatcher>(pattern);
}
// A pattern with no regex metacharacter only has to be compared literally,
// which is what PathParamsMatcher already does when it captures no
// parameter, so std::regex is only worth building for the patterns that
// actually need it
if (pattern.find_first_of(".^$|()[]{}*+?\\") == std::string::npos) {
return detail::make_unique<detail::PathParamsMatcher>(pattern);
}
return detail::make_unique<detail::RegexMatcher>(pattern);
}
Server &Server::Get(const std::string &pattern, Handler handler) {
@@ -8259,15 +8278,12 @@ bool Server::read_content_core(
}
}
if (has_data) {
auto result =
detail::read_content_without_length(strm, payload_max_length_, out);
if (result == detail::ReadContentResult::PayloadTooLarge) {
res.status = StatusCode::PayloadTooLarge_413;
return false;
} else if (result != detail::ReadContentResult::Success) {
return false;
}
return true;
// Route through the same decompressing reader used by the
// length-framed and chunked paths below, so payload_max_length_ is
// enforced on the decompressed size here too instead of only on the
// compressed wire bytes.
return detail::read_content(strm, req, payload_max_length_, res.status,
nullptr, out, true);
}
}
return true;
+23 -2
View File
@@ -8,8 +8,8 @@
#ifndef CPPHTTPLIB_HTTPLIB_H
#define CPPHTTPLIB_HTTPLIB_H
#define CPPHTTPLIB_VERSION "0.53.0"
#define CPPHTTPLIB_VERSION_NUM "0x003500"
#define CPPHTTPLIB_VERSION "0.53.1"
#define CPPHTTPLIB_VERSION_NUM "0x003501"
#ifdef _WIN32
#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0A00
@@ -138,6 +138,18 @@
#define CPPHTTPLIB_RANGE_MAX_COUNT 1024
#endif
// std::regex_match's backtracking implementation (most acutely on libstdc++)
// recurses roughly once per matched character for quantified patterns such
// as "(.*)", so a long enough path can exhaust the calling thread's stack; on
// a default ~8MB thread stack that has been observed to take on the order of
// a couple thousand characters for a simple pattern. 256 leaves a wide safety
// margin below that (well under the 8192-byte request URI limit) while still
// fitting any realistic route segment; raise it if a route legitimately needs
// longer paths. Regex routes are never applied to paths longer than this.
#ifndef CPPHTTPLIB_REGEX_ROUTE_PATH_MAX_LENGTH
#define CPPHTTPLIB_REGEX_ROUTE_PATH_MAX_LENGTH 256
#endif
#ifndef CPPHTTPLIB_TCP_NODELAY
#define CPPHTTPLIB_TCP_NODELAY false
#endif
@@ -839,6 +851,15 @@ inline bool parse_url(const std::string &url, UrlComponents &uc) {
}
pos = close + 1;
// The IPv6 literal is the whole host, so ']' must be followed by a port,
// path, query or fragment delimiter (or the end of input). Otherwise the
// trailing bytes would be folded into the path while the connection
// still targets the bracketed address.
if (pos < url.size()) {
auto c = url[pos];
if (c != ':' && c != '/' && c != '?' && c != '#') { return false; }
}
} else {
auto end = url.find_first_of(":/?#", pos);
if (end == std::string::npos) { end = url.size(); }