File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ use flate2::read::GzDecoder;
24
24
use reqwest:: { header, Client } ;
25
25
use tar:: { self , Archive } ;
26
26
27
+ const CACHE_CONTROL_README : & str = "public,max-age=604800" ;
27
28
const DEFAULT_PAGE_SIZE : usize = 25 ;
28
29
const USAGE : & str = "
29
30
Usage: render-readmes [options]
@@ -129,6 +130,8 @@ fn main() {
129
130
let content_length = readme. len ( ) as u64 ;
130
131
let content = std:: io:: Cursor :: new ( readme) ;
131
132
let readme_path = format ! ( "readmes/{0}/{0}-{1}.html" , krate_name, version. num) ;
133
+ let mut extra_headers = header:: HeaderMap :: new ( ) ;
134
+ extra_headers. insert ( header:: CACHE_CONTROL , CACHE_CONTROL_README . parse ( ) . unwrap ( ) ) ;
132
135
config
133
136
. uploader
134
137
. upload (
@@ -137,7 +140,7 @@ fn main() {
137
140
content,
138
141
content_length,
139
142
"text/html" ,
140
- header :: HeaderMap :: new ( ) ,
143
+ extra_headers ,
141
144
)
142
145
. unwrap_or_else ( |_| {
143
146
panic ! (
Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ use std::sync::Arc;
14
14
use crate :: middleware:: app:: RequestApp ;
15
15
use crate :: models:: Crate ;
16
16
17
- pub const CACHE_CONTROL_IMMUTABLE : & str = "public,max-age=31536000,immutable" ;
18
- pub const CACHE_CONTROL_README : & str = "public,max-age=604800" ;
17
+ const CACHE_CONTROL_IMMUTABLE : & str = "public,max-age=31536000,immutable" ;
18
+ const CACHE_CONTROL_README : & str = "public,max-age=604800" ;
19
19
20
20
#[ derive( Clone , Debug ) ]
21
21
pub enum Uploader {
You can’t perform that action at this time.
0 commit comments