aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2006-02-20 18:00:15 +0000
committerVincent Richard <[email protected]>2006-02-20 18:00:15 +0000
commit56f5f0dce7f17a1464d593c18ed092543569aab1 (patch)
treea70ede0db9bcde609b4b3c8af8e417106d107597
parentMissing libs. (diff)
downloadvmime-56f5f0dce7f17a1464d593c18ed092543569aab1.tar.gz
vmime-56f5f0dce7f17a1464d593c18ed092543569aab1.zip
Accept 8-bit characters even if not allowed (non-strict mode).
-rw-r--r--ChangeLog6
-rw-r--r--vmime/net/imap/IMAPParser.hpp29
2 files changed, 32 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index e8b4c35b..29bdf09b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,12 @@
VERSION 0.8.1cvs
================
+2006-02-20 Vincent Richard <[email protected]>
+
+ * 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 <[email protected]>
* Added service::isSecuredConnection() and service::getConnectionInfos()
diff --git a/vmime/net/imap/IMAPParser.hpp b/vmime/net/imap/IMAPParser.hpp
index 88d751af..ac6310b2 100644
--- a/vmime/net/imap/IMAPParser.hpp
+++ b/vmime/net/imap/IMAPParser.hpp
@@ -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;