CodeVetter · Repo Unpack · Data flow
actix/actix-web
Listener factories assemble a protocol service around application factories before requests enter the application pipeline. Protocol requests carry headers, payloads, connection data, and request extensions into ServiceRequest. Routing mutates match information before extractors produce typed handler arguments, and responders turn results into HTTP output. Filesystem services and outbound client requests introduce separate input/output boundaries with their own transformation and limit rules.
- HttpServer::listen copies timeout, keep-alive, half-close, buffer, and HTTP/2 window settings into HttpService, optionally adds on_connect extensions, then maps the application factory to AppConfig.
- AppInitService::call splits a protocol Request into head and payload, transfers connection/request extensions, reuses or creates an HttpRequest, resets pooled routing state, and forwards a ServiceRequest.
- Router::recognize_fn scans resources in registration order; ResourceDef matches static or dynamic patterns, checks the predicate, stores captured segments, and advances the unprocessed path.
- Data extraction resolves the closest layered Data<T> and clones its Arc-backed wrapper; absent or mismatched registration returns an internal-server-error response rather than creating replacement state.
- Json extraction retrieves JsonConfig, consumes the payload, optionally decompresses it, checks declared and accumulated sizes, and deserializes with serde_json; the default limit is 2,097,152 bytes.
- handler_service maps extractor errors directly to HttpResponse, otherwise awaits Handler::call and Responder::respond_to; Json responders serialize a successful value and emit application/json.
- MultipartForm tracks remaining limits by field name, delegates each Field to T::handle_field, and constructs T from collected state; TempFile streams chunks to disk, consumes total/field budgets, flushes, and retains filename metadata separately.
- awc's RequestSender serializes JSON or URL-encoded forms, adds Content-Type only if absent, wraps the body in ConnectRequest::Client, and invokes the connector with per-request timeout overriding client timeout.