File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -2034,10 +2034,16 @@ impl SenderBuilder {
20342034 #[ cfg( feature = "ilp-over-http" ) ]
20352035 /// Additional time to wait on top of that calculated from the minimum throughput.
20362036 /// This accounts for the fixed latency of the HTTP request-response roundtrip.
2037- /// The value is in milliseconds, and the default is 10 seconds.
2037+ /// The default is 10 seconds.
20382038 /// See also: [`request_min_throughput`](SenderBuilder::request_min_throughput).
20392039 pub fn request_timeout ( mut self , value : Duration ) -> Result < Self > {
20402040 if let Some ( http) = & mut self . http {
2041+ if value. is_zero ( ) {
2042+ return Err ( error:: fmt!(
2043+ ConfigError ,
2044+ "\" request_timeout\" must be greater than 0."
2045+ ) ) ;
2046+ }
20412047 http. request_timeout
20422048 . set_specified ( "request_timeout" , value) ?;
20432049 } else {
Original file line number Diff line number Diff line change @@ -128,6 +128,21 @@ fn incomplete_basic_auth() {
128128 ) ;
129129}
130130
131+ #[ cfg( feature = "ilp-over-http" ) ]
132+ #[ test]
133+ fn zero_timeout_forbidden ( ) {
134+ assert_conf_err (
135+ SenderBuilder :: from_conf ( "http::addr=localhost;username=user123;request_timeout=0;" ) ,
136+ "\" request_timeout\" must be greater than 0." ,
137+ ) ;
138+
139+ assert_conf_err (
140+ SenderBuilder :: new ( Protocol :: Http , "localhost" , 9000 )
141+ . request_timeout ( Duration :: from_millis ( 0 ) ) ,
142+ "\" request_timeout\" must be greater than 0." ,
143+ ) ;
144+ }
145+
131146#[ cfg( feature = "ilp-over-http" ) ]
132147#[ test]
133148fn misspelled_basic_auth ( ) {
You can’t perform that action at this time.
0 commit comments