From: Ian Jackson Date: Sat, 19 Mar 2022 19:09:54 +0000 (+0000) Subject: actix: experiments: Test program: nosniff header X-Git-Tag: otter-1.0.0~120 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=637962b4dfa43c181ce6f334ed97f094b2e111b4;p=otter.git actix: experiments: Test program: nosniff header Signed-off-by: Ian Jackson --- diff --git a/daemon/actix-test.rs b/daemon/actix-test.rs index 9feb7118..a17d5c73 100644 --- a/daemon/actix-test.rs +++ b/daemon/actix-test.rs @@ -7,6 +7,7 @@ use actix_web::HttpRequest; use actix_web::http::Method; use actix_web::HttpResponse; use actix_web::dev::Payload; +use actix_web::middleware; use std::convert::Infallible; @@ -68,6 +69,12 @@ async fn main() -> std::io::Result<()> { .service(index) .service(foo) .default_service(web::to(not_found_handler)) + .wrap( +middleware::DefaultHeaders::new().add(( + actix_web::http::header::X_CONTENT_TYPE_OPTIONS, + "nosniff" +)) + ) ) .bind(("127.0.0.1", 8080))? .run()