Skip to content

blackbull.server.http1_actor

blackbull.server.http1_actor

HTTP/1.1 Actor classes for the BlackBull Actor model (Phase 6 Step 3).

HTTP1Actor drives the keep-alive loop for one TCP connection. RequestActor owns the lifetime of a single HTTP request.

BadRequestError

Bases: Exception

Raised by :meth:HTTP1Actor._parse on an RFC 9112 framing violation.

The actor's keep-alive loop catches this and sends a 400 Bad Request before closing the connection — never tries to dispatch the malformed request to the app.

HTTP1Actor

Bases: Actor

Drives the HTTP/1.1 keep-alive loop for one connection.

Supervisor strategy: isolate — an unhandled exception from a RequestActor closes the connection without crashing sibling connections.

If aggregator is None the actor falls back to the legacy direct- dispatcher path (fires events via app._dispatcher directly), so that BlackBull apps without a full EventAggregator still receive lifecycle events.

run() async

Keep-alive loop — process requests until connection closes.

HeaderTooLargeError

Bases: Exception

Raised when a request header line or the whole header block exceeds the configured limit (BB_HEADER_MAX_LINE / BB_HEADER_MAX_TOTAL).

The actor answers with 431 Request Header Fields Too Large (RFC 6585 §5) and closes the connection. Distinct from :class:BadRequestError because the response status differs.

NotImplementedFramingError

Bases: Exception

RFC 9112 §6.1 — the request used a Transfer-Encoding the server does not implement. Answered with 501 Not Implemented (a separate response code from :class:BadRequestError's 400).

RequestActor

Bases: Actor

Owns one HTTP/1.1 request lifetime.

Spawned by HTTP1Actor, awaited to completion. Calls the ASGI app and emits before_handler / after_handler / request_completed / error via EventAggregator.