IMAPMessage::extract() does not extract headers #10

Closed
gsauthof opened this Issue Jun 16, 2012 · 2 comments

2 participants

@gsauthof

IMAPMessage::extract() should extract the whole message but with libvmime 0.9.2 and current git it does not. It just extracts the body.

The API doc says:

Extract the whole message data (header + contents).

But a call like

vmime::utility::outputStreamByteArrayAdapter out(raw_arr);
msg->extract(out);

yields following IMAP command:

FETCH 1 BODY[TEXT]

And according to RFC 3501:

The TEXT part specifier refers to the text body of the message,
omitting the RFC-2822 header.

The old libvmime 0.8.1 code yields:

FETCH 1 BODY[]

which works as expected because:

An empty section
specification refers to the entire message, including the
header.

(again RFC 3501)

This is a regression. Is used to work with libvmime 0.8.1 and 0.9svn.

For a real example, where the regression introduces a bug see mailcp.

@gsauthof

Btw, to work around this issue I wrote following trivial patch:

--- a/src/net/imap/IMAPMessage.cpp
+++ b/src/net/imap/IMAPMessage.cpp
@@ -280,7 +281,7 @@ void IMAPMessage::extract(ref <const part> p, utility::outputStream& os,
                if (headerOnly)
                        command << "HEADER";
                else
-                       command << "TEXT";
+                       ; //command << "TEXT";
        }
        else
        {
@vincent-richard
Kisli member

Thank you, I fixed that in the git repository.

@vincent-richard vincent-richard added a commit that referenced this issue Jul 6, 2012
@vincent-richard vincent-richard Fixed issue #10. 891aba4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment