Added SMTP service properties to allow disabling PIPELINING and CHUNKING extensions.

This commit is contained in:
Vincent Richard 2013-07-24 13:30:57 +02:00
parent cec80c6335
commit 820d44377e
4 changed files with 22 additions and 2 deletions

View File

@ -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

View File

@ -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),

View File

@ -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 <bool>(getSession(),
dynamic_cast <const SMTPServiceInfos&>(getInfos()).getProperties().PROPERTY_OPTIONS_PIPELINING);
ref <SMTPResponse> resp;
ref <SMTPCommandSet> 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 <bool>(getSession(),
dynamic_cast <const SMTPServiceInfos&>(getInfos()).getProperties().PROPERTY_OPTIONS_CHUNKING))
{
std::ostringstream oss;
utility::outputStreamAdapter ossAdapter(oss);

View File

@ -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;