actix / actix/actix-web

Stop responding in the case of a big size POST request and a 404 result

Offen
#2,906 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
24.8k
Forks
1.9k
Ø Merge
23 Std. 10 Min.
Gemergte PRs (30 T.)
26

Beschreibung

## Current Behavior
Using following simple web server implementation
```
use actix_web::{App, HttpServer};
use env_logger::{Builder, Target};

fn main() -> std::io::Result<()> {
let _ = Builder::from_default_env().target(Target::Stdout).try_init();

let http_server = HttpServer::new(App::new).bind(("127.0.0.1", 8080))?.run();

actix_web::rt::System::new().block_on(async move { http_server.await })
}
```
after submitting the attached big size JSON request [test_actix.postman_collection.json.txt](https://github.com/actix/actix-web/files/9746796/test_actix.postman_collection.json.txt) using [Postman](https://www.postman.com/) a 404 error occurs.
After the first 404 response the **server freezes and stop to response**.

In case of processing and 200 response everithings works.

This scenario opens up to possible DOS attacks

## Expected Behavior
Even in the case of consecutive calls with a 404 result, the server must continue to answer correctly.

## Possible Solution
Avoid freeze and stop response after the first request

## Steps to Reproduce (for bugs)
1. Run the server as reported
2. Submit a first time the attached request via Postman
3. Submit a second time the attached request via Postman

## Context

## Your Environment
WSL2 on Windows 11

- Rust Version: rustc 1.64.0 (a55dd71d5 2022-09-19)
- Actix Web Version: 4.2.1

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.