mirror of
https://github.com/pocoproject/poco.git
synced 2025-03-03 12:58:03 +01:00
enh(Net): SMTPClientSession: replace bare newlines in message content with CRLF (#4689)
This commit is contained in:
parent
54bc0fcb47
commit
42ccb0d96d
@ -65,6 +65,7 @@ private:
|
||||
{
|
||||
ST_DATA,
|
||||
ST_CR,
|
||||
ST_LF,
|
||||
ST_CR_LF,
|
||||
ST_CR_LF_DOT,
|
||||
ST_CR_LF_DOT_DOT,
|
||||
|
@ -132,7 +132,7 @@ int MailStreamBuf::writeToDevice(char c)
|
||||
if (_state == ST_CR)
|
||||
_state = ST_CR_LF;
|
||||
else
|
||||
_state = ST_DATA;
|
||||
_state = ST_LF;
|
||||
break;
|
||||
case '.':
|
||||
if (_state == ST_CR_LF)
|
||||
@ -152,6 +152,11 @@ int MailStreamBuf::writeToDevice(char c)
|
||||
}
|
||||
_pOstr->put(c);
|
||||
}
|
||||
else if (_state == ST_LF)
|
||||
{
|
||||
_buffer += "\r\n";
|
||||
_state = ST_CR_LF;
|
||||
}
|
||||
else if (_state == ST_CR_LF_DOT)
|
||||
{
|
||||
// buffer contains one or more CR-LF pairs
|
||||
|
@ -72,6 +72,7 @@ void MailStreamTest::testMailOutputStream()
|
||||
"Subject: test\r\n"
|
||||
"\r\n"
|
||||
"This is a test.\r\n"
|
||||
"\n.\n"
|
||||
"\rThis.is.\ngarbage\r.\r\n"
|
||||
".This line starts with a period.\r\n"
|
||||
"\r\n"
|
||||
@ -90,7 +91,8 @@ void MailStreamTest::testMailOutputStream()
|
||||
"Subject: test\r\n"
|
||||
"\r\n"
|
||||
"This is a test.\r\n"
|
||||
"\rThis.is.\ngarbage\r.\r\n"
|
||||
"\r\n..\r\n"
|
||||
"\rThis.is.\r\ngarbage\r.\r\n"
|
||||
"..This line starts with a period.\r\n"
|
||||
"\r\n"
|
||||
"..and this one too\r\n"
|
||||
|
Loading…
x
Reference in New Issue
Block a user