mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 16:32:29 +00:00
move keep-alive fix to only close connections where an error occurs
This commit is contained in:
@@ -26,6 +26,8 @@ impl actix_web::error::ResponseError for Error {
|
|||||||
match self {
|
match self {
|
||||||
Error::Unauthorized => HttpResponse::build(self.status_code())
|
Error::Unauthorized => HttpResponse::build(self.status_code())
|
||||||
.append_header(("WWW-Authenticate", "Basic"))
|
.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()),
|
.body(self.to_string()),
|
||||||
_ => HttpResponse::build(self.status_code()).body(self.to_string()),
|
_ => HttpResponse::build(self.status_code()).body(self.to_string()),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use actix_web::http::KeepAlive;
|
|
||||||
use actix_web::HttpServer;
|
use actix_web::HttpServer;
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use app::make_app;
|
use app::make_app;
|
||||||
@@ -57,8 +56,6 @@ async fn main() -> Result<()> {
|
|||||||
|
|
||||||
HttpServer::new(move || make_app(cal_store.clone(), auth.clone()))
|
HttpServer::new(move || make_app(cal_store.clone(), auth.clone()))
|
||||||
.bind((config.http.host, config.http.port))?
|
.bind((config.http.host, config.http.port))?
|
||||||
// This is an unfortunate workaround for https://github.com/actix/actix-web/issues/1805
|
|
||||||
.keep_alive(KeepAlive::Disabled)
|
|
||||||
.run()
|
.run()
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user