mcpp index

mcpplibs.tinyhttps

import

Minimal C++23 HTTP/HTTPS client with SSE streaming support

import mcpplibs.tinyhttps;

模块名读自上游 src/tinyhttps.cppm 里的 `export module` 声明。

mcpp add mcpplibs.tinyhttps@0.2.9

用法

来自本仓库自己的测试项目 —— CI 真的编译并运行过,不是为了网站写的。

import std;
import mcpplibs.tinyhttps;

int main() {
    using namespace mcpplibs::tinyhttps;

    const auto request = HttpRequest::post("https://example.invalid/data", "{\"ok\":true}");
    const auto proxy = parse_proxy_url("http://127.0.0.1:8088/path");
    const auto chunk = parse_chunk_size_line("1a");
    const auto invalid_chunk = parse_chunk_size_line("1x");

    HttpResponse response{204, "No Content", {}, {}};
    const bool ok = request.method == Method::POST
                 && request.url == "https://example.invalid/data"
                 && request.body == "{\"ok\":true}"
                 && request.headers.at("Content-Type") == "application/json"
                 && proxy.host == "127.0.0.1"
                 && proxy.port == 8088
                 && chunk == 26
                 && !invalid_chunk.has_value()
                 && response.ok();
    return ok ? 0 : 1;
// …

tests/examples/tinyhttps/tests/api.cpp · 项目 tests/examples/tinyhttps

构建 · 上游清单

modules
mcpplibs.tinyhttps
targets
tinyhttps (lib)
manifest version
0.2.9
dependencies
compat
来源
https://raw.githubusercontent.com/mcpplibs/tinyhttps/0.2.9/mcpp.toml

版本

版本平台 镜像sha256
0.2.9 最新 LinuxWindowsmacOS CN GLOBAL b17e0b15d2c2…
0.2.8 LinuxWindowsmacOS CN GLOBAL a3d72396b267…
0.2.7 LinuxWindowsmacOS CN GLOBAL c8444d0974e8…
0.2.6 LinuxWindowsmacOS CN GLOBAL 5e0bbc4b7f20…
0.2.5 LinuxWindowsmacOS CN GLOBAL 87084c23d151…
展开全部 9 个版本
0.2.4 LinuxWindowsmacOS CNGLOBAL e9aa33ca770b…
0.2.3 LinuxWindowsmacOS CNGLOBAL 67ff75050d31…
0.2.2 LinuxWindowsmacOS CNGLOBAL bc4cb5947582…
0.2.1 LinuxWindowsmacOS CNGLOBAL 88adc68b1c1e…