mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-08 12:18:07 -05:00
double dot filter : avoid end of message in body (triggers DELE errors)
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@105 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
3f7f9aca5c
commit
dd99fd0d02
@ -1019,7 +1019,26 @@ public class ExchangeSession {
|
|||||||
protected void writeBody(OutputStream os, MimeHeader mimeHeader) throws IOException {
|
protected void writeBody(OutputStream os, MimeHeader mimeHeader) throws IOException {
|
||||||
OutputStream quotedOs;
|
OutputStream quotedOs;
|
||||||
try {
|
try {
|
||||||
quotedOs = (MimeUtility.encode(os, mimeHeader.contentTransferEncoding));
|
// double dot filter : avoid end of message in body
|
||||||
|
quotedOs = new FilterOutputStream(os) {
|
||||||
|
byte state = 0;
|
||||||
|
public void write(int achar) throws IOException {
|
||||||
|
if (achar == 13 && state != 3) {
|
||||||
|
state = 1;
|
||||||
|
} else if (achar == 10 && state == 1) {
|
||||||
|
state = 2;
|
||||||
|
} else if (achar == '.' && state == 2) {
|
||||||
|
state = 3;
|
||||||
|
} else if (achar == 13) {
|
||||||
|
state = 0;
|
||||||
|
super.write('.');
|
||||||
|
} else {
|
||||||
|
state = 0;
|
||||||
|
}
|
||||||
|
super.write(achar);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
quotedOs = (MimeUtility.encode(quotedOs, mimeHeader.contentTransferEncoding));
|
||||||
} catch (MessagingException e) {
|
} catch (MessagingException e) {
|
||||||
throw new IOException(e + " " + e.getMessage());
|
throw new IOException(e + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user