Skip to content

Commit

Permalink
Only apply the request size limit to endpoints that process the reque…
Browse files Browse the repository at this point in the history
…st body
  • Loading branch information
shuni64 committed Nov 27, 2019
1 parent f8506f8 commit 3a05d62
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ impl Server {

let api_kv_key_path = path!("api" / "kv" / String).and(path::end());
let api_kv_key = auth
.and(filters::body::content_length_limit(
configuration.http.request_size_limit,
))
.and(
warp::get2()
.and(store.clone())
Expand All @@ -68,6 +65,9 @@ impl Server {
.and(store.clone())
.and(config.clone())
.and(api_kv_key_path)
.and(filters::body::content_length_limit(
configuration.http.request_size_limit,
))
.and(filters::body::content_length_limit(
configuration.store.max_limit,
))
Expand All @@ -84,6 +84,9 @@ impl Server {
.or(warp::patch()
.and(store.clone())
.and(api_kv_key_path)
.and(filters::body::content_length_limit(
configuration.http.request_size_limit,
))
.and(filters::body::json())
.and_then(patch_key)),
);
Expand Down

0 comments on commit 3a05d62

Please sign in to comment.