GNOME Bugzilla – Bug 137865
duplicate custom headers are overwritten
Last modified: 2011-12-03 18:14:55 UTC
A Debian user reported the following bug: When manualy adding headers, if the headers are identical, only the last one is sent in the post. I am assuming that this is because the custom headers are added to a hash-map during the posting process, causing only the last one to be added. Details at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=238324 I have verified the existance of this bug, though I have been unable to determine if duplicate headers are actually allowed by RFC standards.
Bumping out of the `OBSOLETE' pool: this issue is still true for 0.101. I'll need to check about duplicate headers too.
I'm not sure about news, but mail and therefore Internet message formats in general can take multiple headers of the same type. Consider the Received headers in mail, and it's obvious multiples are allowed. Note that this isn't exactly "duplicate", as the header label is the same, but value (as in the Debian bug example) differs. x-example: content one x-example: content two are different, and allowed in at least some cases, where x-example: content one x-example: content one may or may not be allowed as exact duplicates in value as well. Again, check the Received: headers in mail, where two, three, often more, are very very common.
All of our custom headers are added to the GMimeMessage object via a call to g_mime_message_set_header(), which stores the headers in a hash table keyed by the header name. IMO the headaches added by allowing a GMimeHeader to have multiple headers of the same name would cause far more headaches than it's worth, but I guess that should be fejj's call. Bumping upstream to GMime with a recommendation of NOTABUG/WONTFIX.
you want to use g_mime_message_add_header() set_header() overwrites the previous value for that header if that header already exists in the list, else it adds a new one. If that doesn't solve the problem for you guys, let me know.
Thanks fejj