Expand description
Per-request HTTP/1.1 proxy: bridge an inbound capnp-framed
stream from the edge to the local TCP listener the caller
wants to expose at https://<sub>.trycloudflare.com.
Two code paths share the same entry point:
-
Pooled HTTP/1.1 — for plain requests where both sides advertise
Content-Lengthand no Upgrade / chunked / Connection: close. Acquires a keep-alive socket fromcrate::pool::Pool, forwards Content-Length-bounded request and response bodies, releases the socket back to the pool. Slashes per-request socket connect cost. -
Bidi-pump fallback — WebSocket Upgrades (101 Switching Protocols), Transfer-Encoding: chunked, and close-bound responses run two concurrent byte pumps until either half closes. The socket is dropped at the end; no pooling.
Structs§
- Stream
Counters - Byte counters the supervisor accumulates across all streams.
Constants§
- LOCAL_
CONNECT_ TIMEOUT - How long we wait for the local TCP listener to accept the first byte. Quick tunnels often run alongside a process that just finished booting; 5s gives a generous margin.
Functions§
- handle_
inbound_ stream - Drive one inbound request stream to completion. Reads the
ConnectRequest, dispatches by type, writes theConnectResponseback, pumps the body.