CodeVetter · Repo Unpack · Behavior traces
actix/actix-web
The investigation followed startup, routed handler execution, JSON extraction, multipart disk writes, static delivery, and outbound redirects through their implementation files. Startup consumes application registrations and resolves service/data factories before handling traffic. Request paths branch on guards, extractor failures, and resource defaults. Uploads end in temporary storage unless application code supplies a separate persistence step.
- Startup begins at basic::main → HttpServer::new → bind → bind_addrs → listen → run. bind_addrs attempts every resolved address and returns successful listeners if any bind succeeds, even when another address fails.
- Worker construction proceeds through listen's closure → factory().into_factory() → App::into_factory → AppInit::new_service, which installs a default 404, consumes registrations, and constructs AppRoutingFactory plus the ResourceMap.
- App initialization constructs asynchronous data futures and the endpoint future, awaits data results then endpoint initialization, populates extensions, and returns AppInitService; AppRoutingFactory initializes child services and builds the ordered Router.
- For basic's GET /resource1/{name}/index.html, AppInitService::call → AppRouting::call → ResourceService::call → handler_service → Path::from_request → index produces the greeting. Failed application matching uses 404; unmatched resource routes use the resource's 405 default.
- A JSON handler argument follows Json::from_request → JsonBody::new(...).limit(...) → JsonBody::poll → serde_json::from_slice → JsonExtractFut. Overflow or decoding errors invoke a configured error handler when present and prevent normal handler invocation.
- POST /videos follows Multipart::from_req → MultipartForm::from_request → multipart.try_next → T::handle_field → TempFile::read_field → write_all/flush → T::from_state → post_video. The example returns upload metadata and describes deletion of the temporary file; it contains no promotion to durable storage.
- A static GET follows FilesService::call → PathBufWrap::parse_path → optional path_filter → ordered root lookup → NamedFile::open → into_response. Directory and precompressed branches can return earlier; normal file responses evaluate validators and ranges before streaming.
- An outbound JSON request follows RequestSender::send_json → send_body → connector.call → SendClientRequest. Redirect middleware rebuilds Location targets while budget remains; 301/302/303 can change methods to GET, whereas 307/308 retain the method and reuse only reusable body bytes.