aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/string.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2026-03-13 09:02:52 +0100
committerGitHub Enterprise <[email protected]>2026-03-13 09:02:52 +0100
commit7723e3b48a112d107bb0f6f3c0569b565e937e7d (patch)
treeb6f6803b2dbbdb1415b10e6498603f2f2de54859 /src/zencore/string.cpp
parentAdd --no-network option (#831) (diff)
downloadzen-7723e3b48a112d107bb0f6f3c0569b565e937e7d.tar.xz
zen-7723e3b48a112d107bb0f6f3c0569b565e937e7d.zip
Switch httpclient default back-end over to libcurl (#832)
Switches the default HTTP client to the libcurl-based backend and follows up with a series of correctness fixes and code quality improvements to `CurlHttpClient`. **Backend switch & build fixes:** - Switch default HTTP client to libcurl-based backend - Suppress `[[nodiscard]]` warning when building fmt - Miscellaneous bugfixes in HttpClient/libcurl - Pass `-y` to `xmake config` in `xmake test` task **Boilerplate reduction:** - Add `Session::SetHeaders()` for RAII ownership of `curl_slist`, eliminating manual `curl_slist_free_all` calls from every verb method - Add `Session::PerformWithResponseCallbacks()` to absorb the repeated 12-line write+header callback setup block - Extract `ParseHeaderLine()` shared helper, replacing 4 duplicate header-parsing implementations - Extract `BuildHeaderMap()` and `ApplyContentTypeFromHeaders()` helpers to deduplicate header-to-map conversion and Content-Type scanning - Unify the two `DoWithRetry` overloads (PayloadFile variant now delegates to the Validate variant) **Correctness fixes:** - `TransactPackage`: both phases now use `PerformWithResponseCallbacks()`, fixing missing abort support and a dead header collection loop - `TransactPackage`: error path now routes through `CommonResponse`, preserving curl error codes and messages for the caller - `ValidatePayload`: merged 3 separate header-scan loops into a single pass **Performance improvements:** - Replace `fmt::format` with `ExtendableStringBuilder` in `BuildHeaderList` and `BuildUrlWithParameters`, eliminating heap allocations in the common case - Replace `curl_easy_escape`/`curl_free` with inline URL percent-encoding using `AsciiSet` - Remove wasteful `CommonResponse(...)` construction in retry logging, formatting directly from `CurlResult` fields
Diffstat (limited to 'src/zencore/string.cpp')
-rw-r--r--src/zencore/string.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/zencore/string.cpp b/src/zencore/string.cpp
index ed0ba6f46..358722b0b 100644
--- a/src/zencore/string.cpp
+++ b/src/zencore/string.cpp
@@ -1181,6 +1181,17 @@ TEST_CASE("string")
CHECK(StrCaseCompare("BBr", "Bar", 2) > 0);
}
+ SUBCASE("StrCaseCompare")
+ {
+ CHECK(StrCaseCompare("foo"sv, "FoO"sv) == 0);
+ CHECK(StrCaseCompare("foo"sv, "FoOz"sv) < 0);
+ CHECK(StrCaseCompare("fooo"sv, "FoO"sv) > 0);
+ CHECK(StrCaseCompare("Bar"sv, "bAs"sv) < 0);
+ CHECK(StrCaseCompare("bAr"sv, "Bas"sv) < 0);
+ CHECK(StrCaseCompare("BBr"sv, "Bar"sv) > 0);
+ CHECK(StrCaseCompare("Bbr"sv, "BAr"sv) > 0);
+ }
+
SUBCASE("ForEachStrTok")
{
const auto Tokens = "here,is,my,different,tokens"sv;