actix / actix/actix-web

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

Abierto
#2,906 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Rust
Estrellas
24.8k
Forks
1.9k
Merge medio
23 h 10 min
PR fusionados (30 d)
26

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.