This commit is contained in:
Quentin 2023-06-16 10:19:28 +02:00
parent 486ccf2de0
commit c62f803a95
Signed by: quentin
GPG key ID: E9602264D639FF68
2 changed files with 3 additions and 2 deletions

View file

@ -275,9 +275,10 @@ fn unknown_field(input: &str) -> IResult<&str, HeaderField> {
// Extract field name // Extract field name
let (input, field_name) = field_name(input)?; let (input, field_name) = field_name(input)?;
let (input, body) = unstructured(input)?; let (input, body) = unstructured(input)?;
let (input, _) = perm_crlf(input)?;
Ok((input, HeaderField::Optional(field_name, body))) Ok((input, HeaderField::Optional(field_name, body)))
} }
pub fn field_name(input: &str) -> IResult<&str, &str> { fn field_name(input: &str) -> IResult<&str, &str> {
terminated( terminated(
take_while1(|c| c >= '\x21' && c <= '\x7E' && c != '\x3A'), take_while1(|c| c >= '\x21' && c <= '\x7E' && c != '\x3A'),
pair(tag(":"), space0) pair(tag(":"), space0)

View file

@ -55,7 +55,7 @@ mod tests {
use chrono::{FixedOffset, TimeZone}; use chrono::{FixedOffset, TimeZone};
#[test] #[test]
fn test_received() { fn test_received_body() {
let hdrs = r#"from smtp.example.com ([10.83.2.2]) let hdrs = r#"from smtp.example.com ([10.83.2.2])
by server with LMTP by server with LMTP
id xxxxxxxxx id xxxxxxxxx