h1_server (h1 v0.9.0)

View Source

HTTP/1.1 server connection loop.

Each accepted connection spawns an h1_server process. It owns the socket, performs the TLS handshake (in ssl mode), starts an h1_connection in server mode, and dispatches request events to the user handler.

Summary

Functions

Serve a socket the caller already accepted (and, for TLS, already handshaked). Waits for h1:serve_socket/2 to transfer socket ownership, then runs the same connection loop as an accepted connection — no handshake, no listener registration.

Types

transport/0

-type transport() :: gen_tcp | ssl.

Functions

init_accepted(Parent, Socket, Transport, Handler, ConnOpts, ServerOpts)

-spec init_accepted(pid(), term(), transport(), term(), map(), map()) -> ok.

init_serve(Socket, Transport, Handler, ConnOpts, ServerOpts)

-spec init_serve(term(), transport(), term(), map(), map()) -> ok.

Serve a socket the caller already accepted (and, for TLS, already handshaked). Waits for h1:serve_socket/2 to transfer socket ownership, then runs the same connection loop as an accepted connection — no handshake, no listener registration.