Skip to content

Commit b416276

Browse files
committed
update for DropshotConfig::request_body_max_bytes
1 parent 61490b3 commit b416276

File tree

10 files changed

+58
-15
lines changed

10 files changed

+58
-15
lines changed

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"rust-analyzer.rustfmt.overrideCommand": [
3+
"rustup",
4+
"run",
5+
"nightly-2020-06-02",
6+
"rustfmt"
7+
]
8+
}

Cargo.lock

Lines changed: 14 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ futures = "0.3.1"
1313
http = "0.2.0"
1414
dropshot = { git = "https://github.com/oxidecomputer/dropshot" }
1515
hyper = "0.13"
16-
schemars = { version = "0.7", features = [ "chrono", "uuid" ] }
16+
schemars = { version = "0.8", features = [ "chrono", "uuid" ] }
1717
serde = { version = "1.0", features = [ "derive" ] }
1818
serde_json = "1.0"
1919
tokio = { version = "0.2", features = [ "full" ] }

README.adoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,11 @@ the **external** API (i.e., the one that operators and developers using the
336336
Oxide rack will use). In general, servers can bind to more than one IP address
337337
and port, but this is not (yet?) supported.
338338

339+
|`dropshot_external.request_body_max_bytes`
340+
|`1000`
341+
|Yes
342+
|Specifies the maximum request body size for the **external** API.
343+
339344
|`dropshot_internal`
340345
|
341346
|Yes
@@ -351,6 +356,11 @@ the **internal** API (i.e., the one used by the sled agent). In general,
351356
servers can bind to more than one IP address and port, but this is not (yet?)
352357
supported.
353358

359+
|`dropshot_internal.request_body_max_bytes`
360+
|`1000`
361+
|Yes
362+
|Specifies the maximum request body size for the **internal** API.
363+
354364
|`log`
355365
|
356366
|Yes

examples/config-file.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
[dropshot_external]
66
# IP address and TCP port on which to listen for the external API
77
bind_address = "127.0.0.1:12220"
8+
request_body_max_bytes = 1024
89

910
[dropshot_internal]
1011
# IP address and TCP port on which to listen for the internal API
1112
bind_address = "127.0.0.1:12221"
13+
request_body_max_bytes = 1024
1214

1315
[log]
1416
# Show log messages of this level and more severe

examples/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
[dropshot_external]
66
# IP address and TCP port on which to listen for the external API
77
bind_address = "127.0.0.1:12220"
8+
request_body_max_bytes = 1024
89

910
[dropshot_internal]
1011
# IP address and TCP port on which to listen for the internal API
1112
bind_address = "127.0.0.1:12221"
13+
request_body_max_bytes = 1024
1214

1315
[log]
1416
# Show log messages of this level and more severe

src/bin/sled_agent.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ async fn do_run() -> Result<(), CmdError> {
8080
id: sa_id,
8181
sim_mode,
8282
controller_address: controller_addr,
83-
dropshot: ConfigDropshot {
84-
bind_address: sa_addr,
83+
dropshot: {
84+
let mut c = ConfigDropshot::default();
85+
c.bind_address = sa_addr;
86+
c
8587
},
8688
log: ConfigLogging::StderrTerminal {
8789
level: ConfigLoggingLevel::Info,

src/oxide_controller/config.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,10 @@ mod test {
207207
r##"
208208
[dropshot_external]
209209
bind_address = "10.1.2.3:4567"
210+
request_body_max_bytes = 1024
210211
[dropshot_internal]
211212
bind_address = "10.1.2.3:4568"
213+
request_body_max_bytes = 1024
212214
[log]
213215
mode = "file"
214216
level = "debug"
@@ -217,12 +219,17 @@ mod test {
217219
"##,
218220
)
219221
.unwrap();
222+
220223
assert_eq!(config, ConfigController {
221-
dropshot_external: ConfigDropshot {
222-
bind_address: "10.1.2.3:4567".parse::<SocketAddr>().unwrap(),
224+
dropshot_external: {
225+
let mut c = ConfigDropshot::default();
226+
c.bind_address = "10.1.2.3:4567".parse::<SocketAddr>().unwrap();
227+
c
223228
},
224-
dropshot_internal: ConfigDropshot {
225-
bind_address: "10.1.2.3:4568".parse::<SocketAddr>().unwrap(),
229+
dropshot_internal: {
230+
let mut c = ConfigDropshot::default();
231+
c.bind_address = "10.1.2.3:4568".parse::<SocketAddr>().unwrap();
232+
c
226233
},
227234
log: ConfigLogging::File {
228235
level: ConfigLoggingLevel::Debug,

tests/common/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,10 @@ pub async fn start_sled_agent(
103103
id,
104104
sim_mode: SimMode::Explicit,
105105
controller_address,
106-
dropshot: ConfigDropshot {
107-
bind_address: SocketAddr::new("127.0.0.1".parse().unwrap(), 0),
106+
dropshot: {
107+
let mut c = ConfigDropshot::default();
108+
c.bind_address = SocketAddr::new("127.0.0.1".parse().unwrap(), 0);
109+
c
108110
},
109111
/* TODO-cleanup this is unused */
110112
log: ConfigLogging::StderrTerminal {

tests/config.test.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#
1010
[dropshot_external]
1111
bind_address = "127.0.0.1:0"
12+
request_body_max_bytes = 1024
1213

1314
#
1415
# NOTE: for the test suite, the port MUST be 0 (in order to bind to any
@@ -17,6 +18,7 @@ bind_address = "127.0.0.1:0"
1718
#
1819
[dropshot_internal]
1920
bind_address = "127.0.0.1:0"
21+
request_body_max_bytes = 1024
2022

2123
#
2224
# NOTE: for the test suite, if mode = "file", the file path MUST be the sentinel

0 commit comments

Comments
 (0)