Skip to content

Commit

Permalink
quic: do not log empty cyu array
Browse files Browse the repository at this point in the history
Ticket: OISF#5167
  • Loading branch information
catenacyber committed Jul 4, 2022
1 parent afe3c95 commit 687b59c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions rust/src/quic/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ fn log_template(tx: &QuicTransaction, js: &mut JsonBuilder) -> Result<(), JsonEr
js.set_string("ua", &String::from_utf8_lossy(&ua))?;
}
}
js.open_array("cyu")?;
for cyu in &tx.cyu {
js.start_object()?;
js.set_string("hash", &cyu.hash)?;
js.set_string("string", &cyu.string)?;
if tx.cyu.len() > 0 {
js.open_array("cyu")?;
for cyu in &tx.cyu {
js.start_object()?;
js.set_string("hash", &cyu.hash)?;
js.set_string("string", &cyu.string)?;
js.close()?;
}
js.close()?;
}
js.close()?;

js.close()?;
Ok(())
Expand Down

0 comments on commit 687b59c

Please sign in to comment.