Skip to content

Commit 41a134a

Browse files
committed
misc: small fix or general refactoring i did not bother commenting
1 parent b007e43 commit 41a134a

File tree

1 file changed

+6
-2
lines changed
  • src/plugins/tcp_ports/grabbers

1 file changed

+6
-2
lines changed

src/plugins/tcp_ports/grabbers/http.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,15 @@ pub(crate) async fn http_grabber(
104104
// collect headers
105105
for (name, value) in resp.headers() {
106106
let name = name.to_string();
107-
let value = value.to_str().unwrap();
107+
let mut value = value.to_str().unwrap();
108108

109109
if name == "content-type" {
110+
if value.contains(';') {
111+
value = value.split(';').next().unwrap();
112+
}
110113
content_type = value.to_owned();
111114
}
115+
112116
if headers_of_interest.contains(&name.as_str()) {
113117
banner.insert(name, value.to_owned());
114118
}
@@ -121,7 +125,7 @@ pub(crate) async fn http_grabber(
121125
if let Some(caps) = HTML_TITLE_PARSER.captures(&body) {
122126
banner.insert(
123127
"html.title".to_owned(),
124-
caps.get(1).unwrap().as_str().to_owned(),
128+
caps.get(1).unwrap().as_str().trim().to_owned(),
125129
);
126130
}
127131
} else if content_type.contains("application/") || content_type.contains("text/") {

0 commit comments

Comments
 (0)