diff --git a/src/routes/mod.rs b/src/routes/mod.rs index 026029a7..4583a8a8 100755 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -7,9 +7,8 @@ use chrono::naive::NaiveDateTime; use plume_models::{posts::Post, Connection, CONFIG, ITEMS_PER_PAGE}; use rocket::{ http::{ - hyper::header::{CacheControl, CacheDirective, ETag, EntityTag}, uri::{FromUriParam, Query}, - RawStr, Status, + Header, RawStr, Status, }, request::{self, FromFormValue, FromRequest, Request}, response::{self, Flash, NamedFile, Redirect, Responder, Response}, @@ -208,7 +207,7 @@ pub mod well_known; #[response()] pub struct CachedFile { inner: NamedFile, - cache_control: CacheControl, + cache_control: Header<'static>, } #[derive(Debug)] @@ -228,12 +227,12 @@ impl<'r> Responder<'r> for ThemeFile { { Response::build() .status(Status::NotModified) - .header(ETag(EntityTag::strong(etag))) + .header("ETag", etag) .ok() } else { Response::build() .merge(self.0.respond_to(r)?) - .header(ETag(EntityTag::strong(etag))) + .header("ETag", etag) .ok() } } @@ -256,7 +255,7 @@ pub fn plume_media_files(file: PathBuf) -> Option { .ok() .map(|f| CachedFile { inner: f, - cache_control: CacheControl(vec![CacheDirective::MaxAge(60 * 60 * 24 * 30)]), + cache_control: Header::new("Cache-Control", format!("max-age={}", 60 * 60 * 24 * 30)), }) } #[get("/static/", rank = 3)] @@ -265,6 +264,6 @@ pub fn static_files(file: PathBuf) -> Option { .ok() .map(|f| CachedFile { inner: f, - cache_control: CacheControl(vec![CacheDirective::MaxAge(60 * 60 * 24 * 30)]), + cache_control: Header::new("Cache-Control", format!("max-age={}", 60 * 60 * 24 * 30)), }) } diff --git a/src/template_utils.rs b/src/template_utils.rs index 26bf58b4..4c371ddd 100644 --- a/src/template_utils.rs +++ b/src/template_utils.rs @@ -1,7 +1,6 @@ use plume_models::{notifications::*, users::User, Connection, PlumeRocket}; use crate::templates::Html; -use rocket::http::hyper::header::{ETag, EntityTag}; use rocket::http::{Method, Status}; use rocket::request::Request; use rocket::response::{self, content::Html as HtmlCt, Responder, Response}; @@ -67,12 +66,12 @@ impl<'r> Responder<'r> for Ructe { { Response::build() .status(Status::NotModified) - .header(ETag(EntityTag::strong(etag))) + .header("ETag", etag) .ok() } else { Response::build() .merge(HtmlCt(self.0).respond_to(r)?) - .header(ETag(EntityTag::strong(etag))) + .header("ETag", etag) .ok() } }