Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/parsers/fields/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@ impl<'x> MessageStream<'x> {
match ch {
b'\n' => {
if !self.try_next_is_space() {
return if token_start > 0 {
HeaderValue::Text(String::from_utf8_lossy(
self.bytes(token_start - 1..token_end),
))
} else {
HeaderValue::Empty
};
break;
} else {
continue;
}
Expand All @@ -37,7 +31,13 @@ impl<'x> MessageStream<'x> {
token_end = self.offset();
}

HeaderValue::Empty
if token_start > 0 {
HeaderValue::Text(String::from_utf8_lossy(
self.bytes(token_start - 1..token_end),
))
} else {
HeaderValue::Empty
}
}

pub fn parse_and_ignore(&mut self) {
Expand Down Expand Up @@ -70,6 +70,7 @@ mod tests {
"for <mary@example.net>; 21 Nov 1997 10:05:43 -0600"
),
),
("Re: Saying Hello", "Re: Saying Hello"), // No newline test
];

for (input, expected) in inputs {
Expand Down