From 83c688b3d367b49914b49e696bb66a7ea110ff6c Mon Sep 17 00:00:00 2001 From: Sunrisepeak Date: Fri, 4 Dec 2026 21:35:57 +0900 Subject: [PATCH] feat(tinyhttps): bump mcpplibs.tinyhttps to 0.3.7 (every recv and send bounded; streamed request body) --- .../2026-12-04-bump-tinyhttps-0.3.7-plan.md | 56 +++++++++++++++++++ pkgs/t/tinyhttps.lua | 21 +++++++ tests/examples/tinyhttps/mcpp.toml | 2 +- tests/examples/tinyhttps/tests/api.cpp | 26 ++++++++- 4 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 .agents/docs/2026-12-04-bump-tinyhttps-0.3.7-plan.md diff --git a/.agents/docs/2026-12-04-bump-tinyhttps-0.3.7-plan.md b/.agents/docs/2026-12-04-bump-tinyhttps-0.3.7-plan.md new file mode 100644 index 00000000..c372a857 --- /dev/null +++ b/.agents/docs/2026-12-04-bump-tinyhttps-0.3.7-plan.md @@ -0,0 +1,56 @@ +# Design doc: bump `mcpplibs.tinyhttps` to 0.3.7 + +Date: 2026-12-04 + +This follows the 0.3.6 bump (mcpplibs/mcpp-index#936). Upstream published `0.3.7` +([#29](https://github.com/mcpplibs/tinyhttps/pull/29), which closes +[#28](https://github.com/mcpplibs/tinyhttps/issues/28)). This change adds `0.3.7` to +`pkgs/t/tinyhttps.lua` on the three platforms and moves the consumer to it. gitany needs this +release: its stalled reads (`kal_stream_read`) were the defect that #28 describes, and its streamed +upload is built on `BodySource`. + +## Source and versions + +| | `0.3.7` | +|---|---| +| Upstream | `https://github.com/mcpplibs/tinyhttps` | +| Tag | `0.3.7` (annotated, commit `7d2be50`) | +| Tarball | `archive/refs/tags/0.3.7.tar.gz` | +| sha256 (downloaded twice, and the mirror's copy downloaded twice) | `b8585bc7e94f85acff0f55e30b22680f152489f622b3db270aba71fd468c9f0f` | +| Wrap directory | `tinyhttps-0.3.7/` (the `archive/refs/tags` form, as in every earlier entry) | +| CN mirror | `https://gitcode.com/mcpp-res/tinyhttps/releases/download/0.3.7/tinyhttps-0.3.7.tar.gz`, the same tarball | +| License | Apache-2.0 (unchanged) | + +## What changed upstream + +- `readTimeoutMs` bounds every `recv` and `send`, including the `recv` that completes a TLS record. + Before this, a peer that stopped inside a record held a request indefinitely: with + `readTimeoutMs = 5000` a request was still waiting after 40 s. `Socket::set_idle_timeout`, + `wait_before_send` and `SO_SNDTIMEO` carry the bound, and `write_all` now bounds the time without + progress instead of the whole write. +- `BodySource` is a size plus a reader by offset, and `HttpRequest::bodySource` streams a request body + with `Content-Length`. `BodySource::file(path)` reads a file. A request that sets both `body` and + `bodySource` is refused before anything is sent. + +This is a patch release: a dependency written as `tinyhttps = "^0.3.1"` resolves to it. The module +interface is `mcpplibs.tinyhttps`, as before (Form A, the tarball's own `mcpp.toml`). + +## Descriptor and workspace changes + +- `pkgs/t/tinyhttps.lua`: `["0.3.7"]` is added to `xpm.linux`, `xpm.macosx` and `xpm.windows` + (GLOBAL and CN, one sha256). Every earlier entry is unchanged. +- `tests/examples/tinyhttps/mcpp.toml`: `mcpplibs.tinyhttps = "0.3.7"`. +- `tests/examples/tinyhttps/tests/api.cpp`: a 0.3.7 check that needs no network. It sends a request + with both bodies and expects the refusal, expects `BodySource::file` on a missing path to be empty, + and expects a fresh socket's idle flag to be unset. + +## Verification + +- `mcpp xpkg parse pkgs/t/tinyhttps.lua` succeeds and shows `0.3.7` on the three platforms. +- The GitHub archive was downloaded twice; the mirror asset, uploaded with gitany and checked with + `mirror --verify`, was downloaded back twice. All four copies have the sha256 above. +- Upstream CI for the release commit (mcpplibs/tinyhttps#29) passed 10 of 10 jobs: gcc and llvm on + Linux, macOS, and Windows (msvc and llvm), plus the OpenKal images. +- `tests/examples/tinyhttps`: `mcpp test` resolves `0.3.7` from this tree, downloads it, builds it and passes on Linux (gcc 16.1.0); macOS and Windows are this pull request's workspace jobs. + +Authorship: ai-and-human diff --git a/pkgs/t/tinyhttps.lua b/pkgs/t/tinyhttps.lua index 216c2844..e1549ca4 100644 --- a/pkgs/t/tinyhttps.lua +++ b/pkgs/t/tinyhttps.lua @@ -131,6 +131,13 @@ package = { }, sha256 = "a9d72f53a8ad88daff573657fdf3d90e8f0f877866ebbe7878cfd124894950a5", }, + ["0.3.7"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/tinyhttps/archive/refs/tags/0.3.7.tar.gz", + CN = "https://gitcode.com/mcpp-res/tinyhttps/releases/download/0.3.7/tinyhttps-0.3.7.tar.gz", + }, + sha256 = "b8585bc7e94f85acff0f55e30b22680f152489f622b3db270aba71fd468c9f0f", + }, }, macosx = { ["0.2.1"] = { @@ -252,6 +259,13 @@ package = { }, sha256 = "a9d72f53a8ad88daff573657fdf3d90e8f0f877866ebbe7878cfd124894950a5", }, + ["0.3.7"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/tinyhttps/archive/refs/tags/0.3.7.tar.gz", + CN = "https://gitcode.com/mcpp-res/tinyhttps/releases/download/0.3.7/tinyhttps-0.3.7.tar.gz", + }, + sha256 = "b8585bc7e94f85acff0f55e30b22680f152489f622b3db270aba71fd468c9f0f", + }, }, windows = { ["0.2.1"] = { @@ -373,6 +387,13 @@ package = { }, sha256 = "a9d72f53a8ad88daff573657fdf3d90e8f0f877866ebbe7878cfd124894950a5", }, + ["0.3.7"] = { + url = { + GLOBAL = "https://github.com/mcpplibs/tinyhttps/archive/refs/tags/0.3.7.tar.gz", + CN = "https://gitcode.com/mcpp-res/tinyhttps/releases/download/0.3.7/tinyhttps-0.3.7.tar.gz", + }, + sha256 = "b8585bc7e94f85acff0f55e30b22680f152489f622b3db270aba71fd468c9f0f", + }, }, }, } diff --git a/tests/examples/tinyhttps/mcpp.toml b/tests/examples/tinyhttps/mcpp.toml index 97153fd7..4a1c2f2c 100644 --- a/tests/examples/tinyhttps/mcpp.toml +++ b/tests/examples/tinyhttps/mcpp.toml @@ -10,4 +10,4 @@ name = "tinyhttps-tests" version = "0.1.0" [dependencies] -mcpplibs.tinyhttps = "0.3.6" +mcpplibs.tinyhttps = "0.3.7" diff --git a/tests/examples/tinyhttps/tests/api.cpp b/tests/examples/tinyhttps/tests/api.cpp index 561bfc3e..e8ae28a4 100644 --- a/tests/examples/tinyhttps/tests/api.cpp +++ b/tests/examples/tinyhttps/tests/api.cpp @@ -47,6 +47,26 @@ int main() { extra.extraCaFile = "/etc/corp/root-ca.pem"; HttpClient withExtra(extra); bool (TlsSocket::*connectOver)(Socket&&, const char*, bool, int) = &TlsSocket::connect_over; + // 0.3.7: a request body streamed from a source of known length, read by + // offset; one that is set beside `body` is refused before anything is sent, + // so this needs no network either. The idle bound is the socket's own. + BodySource source; + source.size = 3; + source.read = [](std::int64_t offset, std::span out) -> std::int64_t { + const std::string_view bytes = "abc"; + const auto n = std::min(static_cast(bytes.size()) - offset, static_cast(out.size())); + std::copy_n(bytes.data() + offset, n, out.data()); + return n; + }; + HttpRequest both; + both.method = Method::PUT; + both.url = "https://example.invalid/upload"; + both.body = "inline"; + both.bodySource = source; + const auto refused = client.send(both); + const bool noFile = !BodySource::file("tinyhttps-no-such-file").has_value(); + Socket idle; + idle.set_idle_timeout(500); const bool ok = request.method == Method::POST && request.url == "https://example.invalid/data" && request.body == "{\"ok\":true}" @@ -72,6 +92,10 @@ int main() { && extra.extraCaFile == "/etc/corp/root-ca.pem" && connectOver != nullptr && notStarted // 0.3.6 - && started; + && started + && refused.statusCode == 0 // 0.3.7 + && refused.statusText == "A request has a body or a body source, not both" + && noFile + && !idle.idle_timeout_hit(); return ok ? 0 : 1; }