Skip to content

Commit

Permalink
Add sectxtbin option to enable strict parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
eikendev committed Apr 13, 2024
1 parent 9218a9d commit 135aa8d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sectxtbin/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async fn process_domains(s: &'static Settings) -> (u64, u64) {
.build()
.unwrap();

let options: SecurityTxtOptions = Default::default();
let options: SecurityTxtOptions = SecurityTxtOptions::new(s.strict);

let statuses = stdin(s.threads)
.map(|input| {
Expand Down
4 changes: 4 additions & 0 deletions sectxtbin/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ pub struct Settings {
#[argh(option, default = "3")]
pub timeout: u64,

/// whether to be strict with line endings or more relaxed
#[argh(switch)]
pub strict: bool,

/// only print domains for which the run was successful
#[argh(switch, short = 'q')]
pub quiet: bool,
Expand Down
9 changes: 9 additions & 0 deletions sectxtlib/src/securitytxt_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ pub struct SecurityTxtOptions {
pub strict: bool,
}

impl SecurityTxtOptions {
pub fn new(strict: bool) -> Self {
Self {
now: Utc::now(),
strict: strict,
}
}
}

impl Default for SecurityTxtOptions {
fn default() -> Self {
Self {
Expand Down

0 comments on commit 135aa8d

Please sign in to comment.