diff --git a/src/text/ascii.rs b/src/text/ascii.rs index 9f37738..9c81bb1 100644 --- a/src/text/ascii.rs +++ b/src/text/ascii.rs @@ -136,6 +136,11 @@ pub const TILDE: u8 = 0x7E; // ~ // GROUP OF CHARACTERS // -- CRLF pub const CRLF: &[u8] = &[CR, LF]; +// -- CRCRLF +// Sometimes portable libraries replace transparently +// the "\n" with "\r\n" on Windows. When developpers +// explicitly write "\r\n", the library generates "\r\r\n". +pub const CRCRLF: &[u8] = &[CR, CR, LF]; // -- WHITESPACE pub const WS: &[u8] = &[HT, SP]; diff --git a/src/text/whitespace.rs b/src/text/whitespace.rs index 0e8650a..c48e347 100644 --- a/src/text/whitespace.rs +++ b/src/text/whitespace.rs @@ -22,7 +22,7 @@ use nom::{ /// \r or \n is allowed nowhere else, so we also add this support. pub fn obs_crlf(input: &[u8]) -> IResult<&[u8], &[u8]> { - alt((tag(ascii::CRLF), tag(&[ascii::CR]), tag(&[ascii::LF])))(input) + alt((tag(ascii::CRLF), tag(ascii::CRCRLF), tag(&[ascii::CR]), tag(&[ascii::LF])))(input) } /// ```abnf