English
ours-http-client
libs/http-client — HTTP for a client that brings its own connections: requests and upgrades over HTTP/1.1 on top of a stream, and a pool of HTTP/2 connections per server with their streams.
The boundary with ours-http
Here — only the protocol on top of an already open Io (AsyncRead + AsyncWrite + Send + Unpin): who dials and how TLS is set up does not matter to the library (Secured marks a secured connection). Dialing through an outbound, TLS from ours-mod-tls and the http_client options are in ours-http, which depends on a module and therefore lives in crates/.
The API in outline
http1— one request and the response head, then the body byContent-Length, chunked or until close:read_head,read_body,Head,Body,MAX_HEAD.h2— HTTP/2 streams on top ofours-h2(sing-box 1.14.4'scommon/httpclient): a tunnel or a request body as a byte stream (BodyStream),send_body,headers,parse_uri,split.pool—Pool,Conn,Slot,Settings: one connection to a server at a time with its own driver task, reused untilGOAWAY, a break or idling longer thanidle_timeout. Keep-alive — like x/net'shttp2.Transportwith sing-box's settings: a PING afterkeep_alive_periodof silence, closing if the pong did not arrive withinidle_timeout. Closing an idle connection is our own addition (x/net does not do it): it keeps an abandoned pool from holding a socket. The pool remembers a server's refusal of extended CONNECT.url::Url— onlyhttp/https: the scheme, where to connect, the path and the query.Error— distinguishes errors by what the caller can do: a fallback to HTTP/1.1 is legitimate only when the server does not speak the requested version.
Who uses it
Only ours-http.
Tests
Unit tests in src/ (http1, pool, url); fuzz targets in fuzz/ (response, chunked_roundtrip).