Accept 8-bit characters even if not allowed (non-strict mode).

This commit is contained in:
Vincent Richard 2006-02-20 18:00:15 +00:00
parent e7407fd3a9
commit 56f5f0dce7
2 changed files with 32 additions and 3 deletions

View File

@ -2,6 +2,12 @@
VERSION 0.8.1cvs
================
2006-02-20 Vincent Richard <vincent@vincent-richard.net>
* net/imap/IMAPParser.hpp: added a "relaxed" mode to allow 8-bit
characters where not allowed by the standard (thanks to Tim Teulings
for having found the bug).
2006-01-29 Vincent Richard <vincent@vincent-richard.net>
* Added service::isSecuredConnection() and service::getConnectionInfos()

View File

@ -134,7 +134,7 @@ class IMAPParser : public object
public:
IMAPParser(weak_ref <IMAPTag> tag, weak_ref <socket> sok, weak_ref <timeoutHandler> _timeoutHandler)
: m_tag(tag), m_socket(sok), m_progress(NULL),
: m_tag(tag), m_socket(sok), m_progress(NULL), m_strict(false),
m_literalHandler(NULL), m_timeoutHandler(_timeoutHandler)
{
}
@ -150,6 +150,27 @@ public:
m_socket = sok;
}
/** Set whether we operate in strict mode (this may not work
* with some servers which are not fully standard-compliant).
*
* @param strict true to operate in strict mode, or false
* to operate in default, relaxed mode
*/
void setStrict(const bool strict)
{
m_strict = strict;
}
/** Return true if the parser operates in strict mode, or
* false otherwise.
*
* @return true if we are in strict mode, false otherwise
*/
const bool isStrict() const
{
return m_strict;
}
const string lastLine() const
{
@ -562,14 +583,14 @@ public:
{
}
void go(IMAPParser& /* parser */, string& line, string::size_type* currentPos)
void go(IMAPParser& parser, string& line, string::size_type* currentPos)
{
DEBUG_ENTER_COMPONENT("text");
string::size_type pos = *currentPos;
string::size_type len = 0;
if (m_allow8bits)
if (m_allow8bits || !parser.isStrict())
{
const unsigned char except = m_except;
@ -5000,6 +5021,8 @@ private:
utility::progressListener* m_progress;
bool m_strict;
literalHandler* m_literalHandler;
weak_ref <timeoutHandler> m_timeoutHandler;