Add cache-busting and server headers with a wrapper.
In order to support custom headers for various response types, this commit adds a wrapper type, ResponseWrapper, which can service all types of response in `bin`. For paste objects, the preferred `Last-Modified` is used, so that caches can compare their exact timings with the HEAD response when revalidating. For static objects, an `ETag` is used instead, based on the Cargo version and git hash of the codebase at compilation time; a `build.rs` is used for this.
This commit is contained in:
committed by
Gunwant Jain
parent
55ed495b83
commit
2ab7ddb9c8
@@ -3,6 +3,7 @@ name = "bin"
|
||||
version = "2.0.0"
|
||||
authors = ["Gunwant Jain <mail@wantguns.dev>"]
|
||||
edition = "2021"
|
||||
build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
rand = "0.8.4"
|
||||
@@ -11,6 +12,9 @@ tree_magic = "0.2.3"
|
||||
syntect = "4.6.0"
|
||||
rust-embed="6.3.0"
|
||||
clap = { version = "3.0.9", features = ["derive"] }
|
||||
once_cell = "1"
|
||||
sha256 = "1"
|
||||
time = { version = "0.3", features = ["formatting"] }
|
||||
|
||||
[dependencies.rocket_dyn_templates]
|
||||
version = "0.1.0-rc.1"
|
||||
|
||||
Reference in New Issue
Block a user