From 820d44377e20c3a2ea31f848636c6f49877bdf7b Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Wed, 24 Jul 2013 13:30:57 +0200 Subject: [PATCH] Added SMTP service properties to allow disabling PIPELINING and CHUNKING extensions. --- doc/book/net.tex | 6 ++++++ src/net/smtp/SMTPServiceInfos.cpp | 6 ++++++ src/net/smtp/SMTPTransport.cpp | 9 +++++++-- vmime/net/smtp/SMTPServiceInfos.hpp | 3 +++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/doc/book/net.tex b/doc/book/net.tex index 7653b48e..19a6ccb9 100644 --- a/doc/book/net.tex +++ b/doc/book/net.tex @@ -190,6 +190,12 @@ authentication is not used). \\ transport.smtp.options.need-authentication & bool & Set to \emph{true} if the server requires to authenticate before sending messages. \\ \hline +transport.smtp.options.pipelining & bool & Set to {\vcode false} to disable +command pipelining, if the server supports it (default is {\vcode true}). \\ +\hline +transport.smtp.options.chunking & bool & Set to {\vcode false} to disable +CHUNKING extension, if the server supports it (default is {\vcode true}). \\ +\hline % sendmail \multicolumn{3}{|c|}{sendmail} \\ \hline diff --git a/src/net/smtp/SMTPServiceInfos.cpp b/src/net/smtp/SMTPServiceInfos.cpp index 2927495f..532bb8b8 100644 --- a/src/net/smtp/SMTPServiceInfos.cpp +++ b/src/net/smtp/SMTPServiceInfos.cpp @@ -61,6 +61,9 @@ const SMTPServiceInfos::props& SMTPServiceInfos::getProperties() const property("options.sasl.fallback", serviceInfos::property::TYPE_BOOLEAN, "false"), #endif // VMIME_HAVE_SASL_SUPPORT + property("options.pipelining", serviceInfos::property::TYPE_BOOLEAN, "true"), + property("options.chunking", serviceInfos::property::TYPE_BOOLEAN, "true"), + // Common properties property(serviceInfos::property::AUTH_USERNAME, serviceInfos::property::FLAG_REQUIRED), property(serviceInfos::property::AUTH_PASSWORD, serviceInfos::property::FLAG_REQUIRED), @@ -83,6 +86,9 @@ const SMTPServiceInfos::props& SMTPServiceInfos::getProperties() const property("options.sasl.fallback", serviceInfos::property::TYPE_BOOLEAN, "false"), #endif // VMIME_HAVE_SASL_SUPPORT + property("options.pipelining", serviceInfos::property::TYPE_BOOLEAN, "true"), + property("options.chunking", serviceInfos::property::TYPE_BOOLEAN, "true"), + // Common properties property(serviceInfos::property::AUTH_USERNAME, serviceInfos::property::FLAG_REQUIRED), property(serviceInfos::property::AUTH_PASSWORD, serviceInfos::property::FLAG_REQUIRED), diff --git a/src/net/smtp/SMTPTransport.cpp b/src/net/smtp/SMTPTransport.cpp index 46e47f35..c3431a43 100644 --- a/src/net/smtp/SMTPTransport.cpp +++ b/src/net/smtp/SMTPTransport.cpp @@ -169,7 +169,9 @@ void SMTPTransport::sendEnvelope const bool needReset = m_needReset; - const bool hasPipelining = m_connection->hasExtension("PIPELINING"); + const bool hasPipelining = m_connection->hasExtension("PIPELINING") && + getInfos().getPropertyValue (getSession(), + dynamic_cast (getInfos()).getProperties().PROPERTY_OPTIONS_PIPELINING); ref resp; ref commands = SMTPCommandSet::create(hasPipelining); @@ -334,7 +336,10 @@ void SMTPTransport::send // If CHUNKING is not supported, generate the message to a temporary // buffer then use the send() method which takes an inputStream - if (!m_connection->hasExtension("CHUNKING")) + if (!m_connection->hasExtension("CHUNKING") || + !getInfos().getPropertyValue (getSession(), + dynamic_cast (getInfos()).getProperties().PROPERTY_OPTIONS_CHUNKING)) + { std::ostringstream oss; utility::outputStreamAdapter ossAdapter(oss); diff --git a/vmime/net/smtp/SMTPServiceInfos.hpp b/vmime/net/smtp/SMTPServiceInfos.hpp index 0f38f841..f783194d 100644 --- a/vmime/net/smtp/SMTPServiceInfos.hpp +++ b/vmime/net/smtp/SMTPServiceInfos.hpp @@ -57,6 +57,9 @@ public: serviceInfos::property PROPERTY_OPTIONS_SASL_FALLBACK; #endif // VMIME_HAVE_SASL_SUPPORT + serviceInfos::property PROPERTY_OPTIONS_PIPELINING; + serviceInfos::property PROPERTY_OPTIONS_CHUNKING; + // Common properties serviceInfos::property PROPERTY_AUTH_USERNAME; serviceInfos::property PROPERTY_AUTH_PASSWORD;