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 GLOBAL CN b17e0b15d2c2…
0.2.8 LinuxWindowsmacOS GLOBAL CN a3d72396b267…
0.2.7 LinuxWindowsmacOS GLOBAL CN c8444d0974e8…
0.2.6 LinuxWindowsmacOS GLOBAL CN 5e0bbc4b7f20…
0.2.5 LinuxWindowsmacOS GLOBAL CN 87084c23d151…
展開全部 9 個版本
0.2.4 LinuxWindowsmacOS GLOBALCN e9aa33ca770b…
0.2.3 LinuxWindowsmacOS GLOBALCN 67ff75050d31…
0.2.2 LinuxWindowsmacOS GLOBALCN bc4cb5947582…
0.2.1 LinuxWindowsmacOS GLOBALCN 88adc68b1c1e…