GNOME Bugzilla – Bug 724702
Content-Type header duplicated in parsed message
Last modified: 2014-02-19 14:43:49 UTC
If you try to remove a header from a GMimeMessage that comes out of a GMimeParser, an extra and identical Content-Type header will be appended to the message. It's possible that operations other than removing a header will also result in duplicate Content-Type headers, though I haven't worked on a test case for anything else. See the following example, noting that the header being removed doesn't actually exist (and thus I'd expect the remove_header call to be a no-op): #include <gmime/gmime.h> #include <stdio.h> static const char data[] = { "Date: Tue, 18 Feb 2014 18:18:08 -0800\r\n" "MIME-Version: 1.0\r\n" "Content-Type: multipart/alternative; boundary=asdf\r\n" "\r\n" "--asdf--\r\n" }; int main(void) { g_mime_init(0); GMimeMessage *m = g_mime_parser_construct_message( g_mime_parser_new_with_stream( g_mime_stream_mem_new_with_buffer(data, sizeof(data) - 1) ) ); g_mime_object_remove_header((GMimeObject *) m, "nonexistant"); printf("%s", g_mime_object_to_string((GMimeObject *) m)); return 0; } When I run that program, I see: Date: Tue, 18 Feb 2014 18:18:08 -0800 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=asdf Content-Type: multipart/alternative; boundary=asdf --asdf-- I'd expect to see only one Content-Type header. Tested in GMime master, revision 716e481.
Fixed in git master and I made a 2.6.20 release with the fix included Thanks for the bug report!