1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-01-31 15:20:09 -05:00

Better handle the case where a list in an IMAP response is prematurely ended by CRLF.

Fixes issue 2852
This commit is contained in:
cketti 2011-01-11 03:10:24 +00:00
parent b4635e53b5
commit c7a7d832e7

View File

@ -56,6 +56,7 @@ public class ImapResponseParser
{ {
response.mCommandContinuationRequested = response.mCommandContinuationRequested =
parseCommandContinuationRequest(); parseCommandContinuationRequest();
//TODO: Add special "resp-text" parsing
readTokens(response); readTokens(response);
} }
else else
@ -89,8 +90,17 @@ public class ImapResponseParser
{ {
response.add(token); response.add(token);
} }
/*
* TODO: Check for responses ("OK", "PREAUTH", "BYE", "NO", "BAD")
* that can contain resp-text tokens. If found, hand over to a special
* method that parses a resp-text token. There's no need to use
* readToken()/parseToken() on that data.
*
* See RFC 3501, §9 Formal Syntax (resp-text)
*/
} }
response.mCompleted = token == null; response.mCompleted = (token == null);
} }
/** /**
@ -204,7 +214,7 @@ public class ImapResponseParser
token = parseToken(list); token = parseToken(list);
if (token == null) if (token == null)
{ {
break; return null;
} }
else if (token.equals(")")) else if (token.equals(")"))
{ {
@ -233,7 +243,7 @@ public class ImapResponseParser
token = parseToken(list); token = parseToken(list);
if (token == null) if (token == null)
{ {
break; return null;
} }
else if (token.equals("]")) else if (token.equals("]"))
{ {