Handle non-utf8 status and headers

Non-utf8 headers are ignored and reading the value for them will
yield `None`.
This commit is contained in:
Martin Algesten
2021-03-14 16:43:59 +01:00
parent 9a9dd4ee6c
commit 026cf75690
3 changed files with 212 additions and 82 deletions

View File

@@ -386,7 +386,9 @@ fn send_prelude(unit: &Unit, stream: &mut Stream, redir: bool) -> io::Result<()>
// other headers
for header in &unit.headers {
if !redir || !header.is_name("Authorization") {
write!(prelude, "{}: {}\r\n", header.name(), header.value())?;
if let Some(v) = header.value() {
write!(prelude, "{}: {}\r\n", header.name(), v)?;
}
}
}