Referencia Zigconduit-zig (SDK consumido)

zig/http.zig

Declaraciones públicas de zig/http.zig (conduit-zig (SDK consumido)).

ImplementadoSin versión del tren todavía· generada desde apps/docs/generated/zig/conduit.json

Página generada desde conduit@conduit-0.1.0-f7J_7zg5DwCsHBHItwdOz9ZVq8cvH7ceFsk7-m3-T61t (zig/root.zig). No se edita a mano: bun run docs:gen la regenera y bun run docs:check falla si difiere.

HTTP/1.1 bindings of the wire over std.http + std.Io:

  • serveConnection: one connection of the reference server (CLI serve, interop tests with the TS codec and the C-ABI). styx serves the same server.Server over HTTP/3 from its daemon instead.
  • ClientTransport: a driver.Transport over std.http.Client (CLI upload), thread-safe, keep-alive, TLS when the URL is https.

http.max_head_bytes

const · línea 24

pub const max_head_bytes = 16 * 1024

Sin ///.

http.serveConnection

fn · línea 133

pub fn serveConnection(srv: *server.Server, io: Io, stream: Io.net.Stream) void

Serve requests on stream until the peer closes or a protocol error. Blocking; run one per thread. No admission control of its own: exposed servers run Service, which supervises every connection.

http.ServeOptions

type · línea 343

pub const ServeOptions = struct

Options of Service (and serve). Every limit is on: there is no value that switches admission control off (Service.init refuses zeros), except the per-address cap, which a server behind a proxy cannot use.

A connection is in one of two pools:

  • pre-auth: waiting for or reading a request head, or answering requests that never presented an accepted credential. Small, with an absolute deadline per head; full, the oldest entry is shut down to make room, so holding heads open cannot lock anyone out.
  • authenticated: from the moment Server.begin accepts the credential of a request that has a body until its response is written. Bounded in total and per Grant.subject, with a minimum body rate and an absolute deadline proportional to the body length; over the bounds the request is answered 429 too_many_connections (retryable).

http.ServeOptions.Error

const · línea 381

pub const Error = error{InvalidServeOptions}

Sin ///.

http.ServeOptions.validate

fn · línea 383

pub fn validate(o: ServeOptions) Error!void

Sin ///.

http.TrustedProxy

type · línea 412

pub const TrustedProxy = struct

The proxy in front of a Service (ServeOptions.trusted_proxy).

http.TrustedProxy.min_proof_len

const · línea 422

pub const min_proof_len = 32

Sin ///.

http.TrustedProxy.max_header_len

const · línea 423

pub const max_header_len = 64

Sin ///.

http.Stats

type · línea 431

pub const Stats = struct

Admission counters of a Service (tests, metrics).

http.Service

type · línea 451

pub const Service = struct

Accept loop with one thread per connection (bounded), admission control per pool, subject and address (ServeOptions), and the idle-session sweeper; a consumer can stop it: stop wakes the accept, shuts every open connection down and run returns once every connection thread has finished — so the Server can be deinitialized right after (no thread outlives it).

http.Service.Identity

type · línea 490

pub const Identity = enum

What identify decided about the request just read.

http.Service.InitError

const · línea 518

pub const InitError = ServeOptions.Error || std.mem.Allocator.Error

Sin ///.

http.Service.init

fn · línea 520

pub fn init(gpa: std.mem.Allocator, srv: *server.Server, io: Io, listener: *Io.net.Server, opts: ServeOptions) InitError!Service

Sin ///.

http.Service.deinit

fn · línea 538

pub fn deinit(self: *Service) void

After run returned.

http.Service.stats

fn · línea 544

pub fn stats(self: *Service) Stats

Sin ///.

http.Service.run

fn · línea 558

pub fn run(self: *Service) void

Blocks until stop. Returns only when no connection thread is left.

http.Service.stop

fn · línea 595

pub fn stop(self: *Service) void

Idempotent; callable from any thread (a signal-driven shutdown, a test).

http.serve

fn · línea 899

pub fn serve(srv: *server.Server, io: Io, listener: *Io.net.Server, opts: ServeOptions) !void

Service until the listener fails (CLI serve).

http.ClientTransport

type · línea 907

pub const ClientTransport = struct

Sin ///.

http.ClientTransport.transport

fn · línea 914

pub fn transport(self: *ClientTransport) driver.Transport

Sin ///.