Skip to content

Commit

Permalink
make Http[s]ListenerConfig::http_answers optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Keksoj committed Apr 5, 2024
1 parent a2236d1 commit ee2430f
Show file tree
Hide file tree
Showing 12 changed files with 158 additions and 117 deletions.
76 changes: 35 additions & 41 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions command/src/command.proto
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ message HttpListenerConfig {
required uint32 request_timeout = 10 [default = 10];
// wether the listener is actively listening on its socket
required bool active = 11 [default = false];
required CustomHttpAnswers http_answers = 12;
optional CustomHttpAnswers http_answers = 12;
}

// details of an HTTPS listener
Expand Down Expand Up @@ -161,7 +161,7 @@ message HttpsListenerConfig {
// The tickets allow the client to resume a session. This protects the client
// agains session tracking. Defaults to 4.
required uint64 send_tls13_tickets = 20;
required CustomHttpAnswers http_answers = 21;
optional CustomHttpAnswers http_answers = 21;
}

// details of an TCP listener
Expand Down
4 changes: 2 additions & 2 deletions command/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ impl ListenerBuilder {
}

/// Get the custom HTTP answers from the file system using the provided paths
fn get_http_answers(&self) -> Result<CustomHttpAnswers, ConfigError> {
fn get_http_answers(&self) -> Result<Option<CustomHttpAnswers>, ConfigError> {
let http_answers = CustomHttpAnswers {
answer_301: read_http_answer_file(&self.answer_301)?,
answer_400: read_http_answer_file(&self.answer_400)?,
Expand All @@ -440,7 +440,7 @@ impl ListenerBuilder {
answer_504: read_http_answer_file(&self.answer_504)?,
answer_507: read_http_answer_file(&self.answer_507)?,
};
Ok(http_answers)
Ok(Some(http_answers))
}

/// Assign the timeouts of the config to this listener, only if timeouts did not exist
Expand Down
3 changes: 1 addition & 2 deletions command/src/logging/logs.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::{
cell::RefCell,
cmp,
env,
cmp, env,
fmt::Arguments,
fs::{File, OpenOptions},
io::{stdout, Error as IoError, ErrorKind as IoErrorKind, Stdout, Write},
Expand Down
Loading

0 comments on commit ee2430f

Please sign in to comment.