Skip to content

Commit 95dc4dc

Browse files
committed
feat: add quirk for missing space in continue req command
Refs: #638
1 parent 76697ef commit 95dc4dc

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

imap-codec/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ quirk = [
2828
"quirk_rectify_numbers",
2929
"quirk_trailing_space",
3030
"quirk_spaces_between_addresses",
31+
"quirk_continue_req_space_relaxed",
3132
"quirk_body_fld_enc_nil_to_empty",
3233
]
3334
# Make `\r` in `\r\n` optional.
@@ -42,6 +43,8 @@ quirk_rectify_numbers = []
4243
quirk_spaces_between_addresses = []
4344
# Accept a trailing space in `STATUS` data response.
4445
quirk_trailing_space = []
46+
# Accept continuation request commands without required space `+\r\n`
47+
quirk_continue_req_space_relaxed = []
4548
# Encode NIL `body-fld-enc` as empty string.
4649
quirk_body_fld_enc_nil_to_empty = []
4750

imap-codec/src/response.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,11 @@ pub(crate) fn continue_req(input: &[u8]) -> IMAPResult<&[u8], CommandContinuatio
271271
}
272272

273273
let mut parser = tuple((
274-
tag(b"+ "),
274+
tag(b"+"),
275+
#[cfg(feature = "quirk_continue_req_space_relaxed")]
276+
opt(sp),
277+
#[cfg(not(feature = "quirk_continue_req_space_relaxed"))]
278+
sp,
275279
alt((
276280
#[cfg(not(feature = "quirk_crlf_relaxed"))]
277281
map(
@@ -294,7 +298,7 @@ pub(crate) fn continue_req(input: &[u8]) -> IMAPResult<&[u8], CommandContinuatio
294298
crlf,
295299
));
296300

297-
let (remaining, (_, either, _)) = parser(input)?;
301+
let (remaining, (_, _, either, _)) = parser(input)?;
298302

299303
let continue_request = match either {
300304
Either::Base64(data) => CommandContinuationRequest::base64(data),

0 commit comments

Comments
 (0)