Expand description
The HTTP seam behind fetch() / http(): the
HttpClient trait and its request and response types,
plus the HttpDispatch trait that decides who runs a
request. lumen-http-ureq is the client Lumen ships.
The HTTP seam behind the scripts’ fetch(url, tag) and http(#{...})
builtins.
HttpClient is the transport contract: one blocking call that turns an
HttpRequest into an HttpResponse, with a byte cap on the body it
buffers. The client Lumen ships is lumen-http-ureq, selected by the
default-on http-fetch feature. An embedder that needs a different stack (a
proxy-aware client, a recording client in tests, an in-process fake)
implements the trait and installs it with
FetchRegistry::with_client
before the script plugin builds.
HttpDispatch is the concurrency contract next to it: who runs the
request and how its reply gets back. ThreadDispatch is the one every
desktop build uses, a worker thread per request blocked in
HttpClient::send. A platform with no threads to block supplies its own
and installs it with
FetchRegistry::with_dispatch;
in a browser that is lumen-web-http, which runs the request on the page’s
own fetch and needs no client behind it.
HttpHook is how a plugin takes part in every request without replacing
either: it adjusts a request just before it is dispatched and reads each
reply before the script does. The hooks live in
HttpHooks, apart from the registry, so they
survive a client being swapped.
The types are transport-only on purpose: the delivery tag, the
fetch()-versus-http() reply style, and the retry or logging policy all
stay on the runtime side of the seam, so a client implementation never has
to know what a script is.
Structs§
- Disabled
Http Client - The client a build without the
http-fetchfeature gets: every request resolves to an error carrying the rebuild hint, so a size-trimmed binary says whyfetch()did nothing instead of silently dropping it. - Http
Request - A request handed to a client on a per-request worker thread. Method, url,
headers, and body in: the input half of the Qt
QNetworkRequestshape. - Http
Response - The reply half of the Qt
QNetworkReplyshape: status, headers, and body out. - Thread
Dispatch - The dispatcher every desktop build runs: one worker thread per request,
blocked in
HttpClient::senduntil the reply lands. - Unknown
Credentials - A
credentialsvalue that is none of the three webfetchnames.
Enums§
- Credentials
- Which requests carry credentials (cookies, HTTP authentication, client
certificates), with the meaning web
fetchgives itscredentialsoption.
Traits§
- Http
Client - The transport a script’s HTTP builtins run on.
- Http
Dispatch - How a request leaves the calling thread and how its reply comes back.
- Http
Hook - Something that takes part in every HTTP exchange a script starts, whichever client and dispatcher carry it.
Type Aliases§
- Http
Done - The completion callback a dispatcher owns for the life of one request. It is called exactly once, from whatever thread or task the reply arrived on, and it never touches the world: all it does is hand the outcome to the channel the world thread drains.