diff --git a/imap-proto/src/parser/rfc3501.rs b/imap-proto/src/parser/rfc3501.rs index 922823d..42075e8 100644 --- a/imap-proto/src/parser/rfc3501.rs +++ b/imap-proto/src/parser/rfc3501.rs @@ -471,7 +471,8 @@ named!(resp_text<(Option, Option<&str>)>, do_parse!( )); named!(continue_req, do_parse!( - tag!("+ ") >> + tag!("+") >> + opt!(tag!(" ")) >> // Some servers do not send the space :/ text: resp_text >> // TODO: base64 tag!("\r\n") >> (Response::Continue { @@ -837,4 +838,25 @@ mod tests { rsp => panic!("should be incomplete: {:?}", rsp), } } + + #[test] + fn test_continuation() { + // regular RFC compliant + match parse_response(b"+ \r\n") { + Ok((_, Response::Continue { + code: None, + information: None, + })) => {} + rsp @ _ => panic!("unexpected response {:?}", rsp) + } + + // short version, sent by yandex + match parse_response(b"+\r\n") { + Ok((_, Response::Continue { + code: None, + information: None, + })) => {} + rsp @ _ => panic!("unexpected response {:?}", rsp) + } + } }