Skip to content

Commit

Permalink
update max request size
Browse files Browse the repository at this point in the history
Signed-off-by: Jess Frazelle <[email protected]>
  • Loading branch information
jessfraz committed Dec 3, 2020
1 parent b91b920 commit 8af802f
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions dropshot/examples/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ async fn main() -> Result<(), String> {
*/
let config_dropshot = ConfigDropshot {
bind_address: "127.0.0.1:0".parse().unwrap(),
request_body_max_bytes: None,
};

/*
Expand Down
1 change: 1 addition & 0 deletions dropshot/examples/pagination-basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ async fn main() -> Result<(), String> {
let ctx = Arc::new(tree);
let config_dropshot = ConfigDropshot {
bind_address: SocketAddr::from((Ipv4Addr::LOCALHOST, port)),
request_body_max_bytes: None,
};
let config_logging = ConfigLogging::StderrTerminal {
level: ConfigLoggingLevel::Debug,
Expand Down
1 change: 1 addition & 0 deletions dropshot/examples/pagination-multiple-resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ async fn main() -> Result<(), String> {
let ctx = Arc::new(DataCollection::new());
let config_dropshot = ConfigDropshot {
bind_address: SocketAddr::from((Ipv4Addr::LOCALHOST, port)),
request_body_max_bytes: None,
};
let config_logging = ConfigLogging::StderrTerminal {
level: ConfigLoggingLevel::Debug,
Expand Down
1 change: 1 addition & 0 deletions dropshot/examples/pagination-multiple-sorts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ async fn main() -> Result<(), String> {
let ctx = Arc::new(ProjectCollection::new());
let config_dropshot = ConfigDropshot {
bind_address: SocketAddr::from((Ipv4Addr::LOCALHOST, port)),
request_body_max_bytes: None,
};
let config_logging = ConfigLogging::StderrTerminal {
level: ConfigLoggingLevel::Debug,
Expand Down
2 changes: 2 additions & 0 deletions dropshot/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@ use std::net::SocketAddr;
pub struct ConfigDropshot {
/** IP address and TCP port to which to bind for accepting connections */
pub bind_address: SocketAddr,
/** maximum allowed size of a request body, defaults to 1024 if unspecified */
pub request_body_max_bytes: Option<usize>,
}
2 changes: 1 addition & 1 deletion dropshot/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ impl HttpServer {
private,
config: ServerConfig {
/* We start aggressively to ensure test coverage. */
request_body_max_bytes: 1024,
request_body_max_bytes: config.request_body_max_bytes.unwrap_or(1024),
page_max_nitems: NonZeroUsize::new(10000).unwrap(),
page_default_nitems: NonZeroUsize::new(100).unwrap(),
},
Expand Down
1 change: 1 addition & 0 deletions dropshot/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub fn test_setup(test_name: &str, api: ApiDescription) -> TestContext {
*/
let config_dropshot = ConfigDropshot {
bind_address: "127.0.0.1:0".parse().unwrap(),
request_body_max_bytes: None,
};

let config_logging = ConfigLogging::File {
Expand Down

0 comments on commit 8af802f

Please sign in to comment.