socket, ssl, or http modules — those bare names are rejected with a diagnostic and the correct sifr.* replacement is suggested. This page covers the four public networking modules and how they compose.
Module Map
TCP with sifr.net
connect_tcp opens an async TCP stream to a remote address. listen_tcp binds a local port and returns a listener that accepts incoming connections:
Network operations consume Sifr’s concurrency runtime for cancellation, deadlines, and backpressure. Use
task.scope() or task.timeout() from sifr.task to bound the lifetime of network operations. See Concurrency Overview for the structured task model, and Concurrency API for the full sifr.task surface.TLS with sifr.tls
Wrap a TCP connection in TLS using a client configuration built from a CA certificate bundle:
HTTP Substrate with sifr.http
sifr.http provides the typed HTTP protocol layer: request and response heads, header maps, body streams, and cookie parsing. This is a substrate API — it gives you the building blocks rather than a full client or server framework.
Headers
Build aHeaderMap from a list of (name, value) pairs using headers_from_pairs:
Request and Response Heads
Construct typed request and response heads withrequest_head and response_head:
Body Streams
BodyStream lets you collect a response body with an explicit size limit, preventing runaway memory growth from oversized payloads:
Cookie Parsing
Parse theCookie header into a list of (name, value) tuples:
Full HTTP Substrate Demo
The following is the complete HTTP substrate demo from the Sifr repository:URL Parsing with sifr.url
Parse and decompose URLs with sifr.url:
What Is Not in This Release
The networking substrate is production-ready for TCP, TLS, and HTTP/1.1 and HTTP/2 transport. The following features are deferred to future capabilities:- High-level HTTP client (retries, auth, compression, redirects)
- Server routing, middleware, and request extractors
- WebSocket and HTTP/3 support
SO_REUSEPORTand multi-worker serving
