* calculate the body start pos while iterating, so we can react the same way we did before
/* Strip the field out of the RFC822 header if we used it */
if (!converted) {
StrBufAppendBufPlain(OtherHeaders, beg, end - beg, 0);
/* Strip the field out of the RFC822 header if we used it */
if (!converted) {
StrBufAppendBufPlain(OtherHeaders, beg, end - beg, 0);
+ StrBufAppendBufPlain(OtherHeaders, HKEY("\n"), 0);
}
/* If we've hit the end of the message, bail out */
}
/* If we've hit the end of the message, bail out */
}
else if (mode == MT_RFC822) { /* unparsed RFC822 dump */
int eoh = 0;
}
else if (mode == MT_RFC822) { /* unparsed RFC822 dump */
int eoh = 0;
+ const char *StartOfText = StrBufNOTNULL;
char outbuf[1024];
int outlen = 0;
int nllen = strlen(nl);
char outbuf[1024];
int outlen = 0;
int nllen = strlen(nl);
while (*mptr != '\0') {
if (*mptr == '\r') {
/* do nothing */
while (*mptr != '\0') {
if (*mptr == '\r') {
/* do nothing */
eoh = (*(mptr+1) == '\r') && (*(mptr+2) == '\n');
if (!eoh)
eoh = *(mptr+1) == '\n';
eoh = (*(mptr+1) == '\r') && (*(mptr+2) == '\n');
if (!eoh)
eoh = *(mptr+1) == '\n';
+ if (eoh)
+ {
+ StartOfText = mptr;
+ StartOfText = strchr(StartOfText, '\n');
+ StartOfText = strchr(StartOfText, '\n');
+ }
-
- if (
- ((headers_only == HEADERS_NONE) && (eoh))
- || ((headers_only == HEADERS_ONLY) && (!eoh))
- || ((headers_only != HEADERS_NONE) && (headers_only != HEADERS_ONLY))
+ if (((headers_only == HEADERS_NONE) && (mptr >= StartOfText)) ||
+ ((headers_only == HEADERS_ONLY) && (mptr < StartOfText)) ||
+ ((headers_only != HEADERS_NONE) &&
+ (headers_only != HEADERS_ONLY))
) {
if (*mptr == '\n') {
memcpy(&outbuf[outlen], nl, nllen);
) {
if (*mptr == '\n') {
memcpy(&outbuf[outlen], nl, nllen);
- if ((prev_ch == '\n') && (*mptr == '.') && ((*(mptr+1) == '\r') || (*(mptr+1) == '\n')))
+ if ((prev_ch == '\n') &&
+ (*mptr == '.') &&
+ ((*(mptr+1) == '\r') || (*(mptr+1) == '\n')))
{
outbuf[outlen++] = '.';
}
{
outbuf[outlen++] = '.';
}
++mptr;
if (outlen > 1000) {
client_write(outbuf, outlen);
++mptr;
if (outlen > 1000) {
client_write(outbuf, outlen);