actix / actix/actix-web

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

Aperta
#2,906 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
24.8k
Fork
1.9k
Merge medio
23h 10m
PR unite (30g)
26

Descrizione

## 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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.