move keep-alive fix to only close connections where an error occurs

This commit is contained in:
Lennart
2024-03-16 00:05:51 +01:00
parent af870c305b
commit 55342309b9
2 changed files with 2 additions and 3 deletions

View File

@@ -26,6 +26,8 @@ impl actix_web::error::ResponseError for Error {
match self {
Error::Unauthorized => HttpResponse::build(self.status_code())
.append_header(("WWW-Authenticate", "Basic"))
// This is an unfortunate workaround for https://github.com/actix/actix-web/issues/1805
.force_close()
.body(self.to_string()),
_ => HttpResponse::build(self.status_code()).body(self.to_string()),
}