Skip to content

Commit

Permalink
Add http event field to store post body (#85)
Browse files Browse the repository at this point in the history
* Add http event field to store post body

* Display post body

* Fix clippy warning

---------

Co-authored-by: Jungkeun Park <[email protected]>
  • Loading branch information
jknpark and jknpark committed Nov 24, 2023
1 parent 10143c7 commit 18e9eae
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/ingest/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,14 @@ pub struct Http {
pub orig_mime_types: Vec<String>,
pub resp_filenames: Vec<String>,
pub resp_mime_types: Vec<String>,
pub post_body: Vec<u8>,
}

impl Display for Http {
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
write!(
f,
"{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}",
"{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}",
self.orig_addr,
self.orig_port,
self.resp_addr,
Expand All @@ -271,6 +272,11 @@ impl Display for Http {
vec_to_string_or_default(&self.orig_mime_types),
vec_to_string_or_default(&self.resp_filenames),
vec_to_string_or_default(&self.resp_mime_types),
if self.post_body.is_empty() {
String::from("-")
} else {
std::str::from_utf8(self.post_body.as_slice()).unwrap_or_default().replace('\t', " ")
}
)
}
}
Expand Down

0 comments on commit 18e9eae

Please sign in to comment.