diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-04-17 15:33:12 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-04-18 19:00:32 +0300 |
commit | 27aae941c77f38392a1b058ce8fb04241c143331 (patch) | |
tree | ce4dce20c44837c5be0c004fefcd931089a88c50 /mh/tests | |
parent | c010cf73e93cbd46a89ef3a6e76a836974bb736b (diff) | |
download | mailutils-27aae941c77f38392a1b058ce8fb04241c143331.tar.gz mailutils-27aae941c77f38392a1b058ce8fb04241c143331.tar.bz2 |
Fix semantics of mu_header_set_value and creation of multipart/alternative MIME
Until now, mu_header_set_value called with replace=0 prepended the header
to the header list, if a header with such name was already present. This
has been changed. Now, if the header with the requested name is already
present, its action is as follows:
1. If repl is 0, return MU_ERR_EXISTS
2. Otherwise, replace the header with the new value.
If the header is not present, it is appended to the end of the header
list, instead of putting it at the beginning.
This change is incompatible and breaks the tests, that relied on a particular
field ordering. These are fixed as well.
The use of mu_header_set_value throughout the sources has been revised to
ensure that single-instance headers are never added twice.
This change also facilitates the second part of this commit, which
fixes creation of the multipart/alternative message by the mail utility.
* libmailutils/mailbox/header.c (mu_header_set_value): Fix semantics.
If the replace parameter is not set and the header field with the
given name already exists, return MU_ERR_EXISTS without changing
anything. If adding new header, append it to the end of the header
list, instead of pushing it to the top.
* configure.ac: Raise shared library revision number.
* libmu_scm/mu_message.c (mu-message-set-header)
(mu-message-set-header-fields): call mu_header_set_value explicitly if
repl is not set.
* libmu_sieve/extensions/moderator.c: Force replace header mode when
needed.
* libmu_sieve/extensions/vacation.c: Likewise.
* mh/mh_init.c (mh_annotate): Prepend the annotation header.
* mh/mhn.c: Force replace header mode when needed.
* mh/repl.c: Likewise.
* mh/send.c: Likewise.
* libmailutils/tests/modmesg01.at: Change expected header order.
* libmailutils/tests/modmesg03.at: Likewise.
* mh/tests/mhn.at: Likewise.
* mh/tests/send.at: Likewise.
* sieve/tests/moderator.at: Likewise.
* sieve/tests/redirect.at: Likewise.
* sieve/tests/reject.at: Likewise.
* sieve/tests/vacation.at: Likewise.
* examples/mta.c (message_finalize): Append X-Authentication-Warning,
instead of setting it.
Make sure Content-Disposition is not set for parts of a multipart/
alternative MIME message. Some mail readers (notably, yahoo),
misinterpret it.
* libmailutils/mime/attachment.c (at_hdr): Use mu_header_set_value
to set Content-Type and Content-Disposition.
* libmailutils/mime/mime.c (_mime_set_content_type): If the content
type is set to multipart/alternative, remove the Content-Disposition
headers from the message parts.
* mail/send.c (saveatt): Don't set content-disposition for
multipart/alternative, it is now done by the library.
(add_attachments): Warn about ignored headers.
Append only Received and X-* headers, replace others.
(parse_headers): Append headers.
(compose_header_set): Use mu_header_append if COMPOSE_APPEND is requested.
* mail/util.c (util_header_expand): Use mu_header_append.
Diffstat (limited to 'mh/tests')
-rw-r--r-- | mh/tests/mhn.at | 64 | ||||
-rw-r--r-- | mh/tests/send.at | 60 |
2 files changed, 62 insertions, 62 deletions
diff --git a/mh/tests/mhn.at b/mh/tests/mhn.at index 1f62f4844..51d579abf 100644 --- a/mh/tests/mhn.at +++ b/mh/tests/mhn.at @@ -461,18 +461,18 @@ mimeflt input [0], [From: gray@example.net Subject: Adjacent plain text contexts -Content-Type: multipart/mixed; boundary="BOUNDARY-1" MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="BOUNDARY-1" --BOUNDARY-1 -Content-ID: 1 Content-Type: text/plain +Content-ID: 1 this is the first content --BOUNDARY-1 -Content-ID: 2 Content-Type: text/plain +Content-ID: 2 and this is the second @@ -499,26 +499,26 @@ mimeflt input [0], [From: gray@example.net Subject: Plaintext content types -Content-Type: multipart/mixed; boundary="BOUNDARY-1" MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="BOUNDARY-1" --BOUNDARY-1 -Content-Description: First part -Content-ID: 1 Content-Type: text/enriched +Content-ID: 1 +Content-Description: First part this content will be tagged as text/enriched --BOUNDARY-1 -Content-ID: 2 Content-Type: text/plain +Content-ID: 2 and this content will be tagged as text/plain --BOUNDARY-1 -Content-Description: this is a patch -Content-ID: 3 Content-Type: application/x-patch +Content-ID: 3 +Content-Description: this is a patch and this content will be tagged as application/x-patch @@ -540,8 +540,8 @@ mimeflt input [0], [From: gray@example.net Subject: Sharp at the beginning of a line -Content-Type: text/plain MIME-Version: 1.0 +Content-Type: text/plain #when sent, this line will start with only one # @@ -562,9 +562,9 @@ mimeflt input [0], [From: gray@example.net Subject: Charset -Content-Transfer-Encoding: quoted-printable -Content-Type: text/plain; charset=utf-8 MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: quoted-printable Cze=C5=9B=C4=87 @@ -586,9 +586,9 @@ mimeflt input [0], [From: gray@example.net Subject: Forwards -Content-Description: forwarded messages -Content-Type: multipart/digest; boundary="BOUNDARY-1" MIME-Version: 1.0 +Content-Type: multipart/digest; boundary="BOUNDARY-1" +Content-Description: forwarded messages --BOUNDARY-1 Content-Type: message/rfc822 @@ -713,9 +713,9 @@ mimeflt input [0], [From: gray@example.net Subject: Forwards -Content-Description: forwarded messages -Content-Type: multipart/digest; boundary="BOUNDARY-1" MIME-Version: 1.0 +Content-Type: multipart/digest; boundary="BOUNDARY-1" +Content-Description: forwarded messages --BOUNDARY-1 Content-Type: message/rfc822 @@ -839,9 +839,9 @@ mimeflt input [0], [From: gray@example.net Subject: Forwards -Content-Description: forwarded messages -Content-Type: message/rfc822 MIME-Version: 1.0 +Content-Type: message/rfc822 +Content-Description: forwarded messages Received: (from foobar@nonexistent.net) by nonexistent.net id fBSKI8N04906 @@ -915,12 +915,12 @@ mimeflt input [0], [From: gray@example.net Subject: External data -Content-Type: message/external-body; name="mailutils-3.0.tar.gz"; directory="/gnu/mailutils"; site="ftp.gnu.org"; access-type=anon-ftp; mode="image" MIME-Version: 1.0 +Content-Type: message/external-body; name="mailutils-3.0.tar.gz"; directory="/gnu/mailutils"; site="ftp.gnu.org"; access-type=anon-ftp; mode="image" -Content-Description: GNU Mailutils distribution -Content-ID: 1 Content-Type: application/octet-stream; type=tar; conversions=compress +Content-ID: 1 +Content-Description: GNU Mailutils distribution ]) @@ -956,25 +956,25 @@ mimeflt input [0], [From: gray@example.net Subject: Multipart -Content-Type: multipart/mixed; boundary="BOUNDARY-1" MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="BOUNDARY-1" --BOUNDARY-1 -Content-ID: 1 Content-Type: text/plain +Content-ID: 1 Initial text part. --BOUNDARY-1 -Content-Type: multipart/mixed; boundary="BOUNDARY-2" MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="BOUNDARY-2" --BOUNDARY-2 -Content-Description: forwarded message -Content-ID: 2 -Content-Type: message/rfc822 MIME-Version: 1.0 +Content-Type: message/rfc822 +Content-ID: 2 +Content-Description: forwarded message Received: (from foobar@nonexistent.net) by nonexistent.net id fBSKI8N04906 @@ -1025,22 +1025,22 @@ And the mome raths outgrabe. --BOUNDARY-2 -Content-ID: 3 Content-Type: text/plain +Content-ID: 3 Plain text 1 --BOUNDARY-2 -Content-ID: 4 Content-Type: text/x-special +Content-ID: 4 Plain text 2 --BOUNDARY-2 -Content-Transfer-Encoding: base64 -Content-Description: Tar archive -Content-ID: 5 Content-Type: application/octet-stream; type=tar +Content-ID: 5 +Content-Description: Tar archive +Content-Transfer-Encoding: base64 Tm90IGEgdGFyYmFsbCwgcmVhbGx5Cg== --BOUNDARY-2-- diff --git a/mh/tests/send.at b/mh/tests/send.at index cd7331734..18d1df1e0 100644 --- a/mh/tests/send.at +++ b/mh/tests/send.at @@ -34,11 +34,11 @@ find . -name ,input [0], [ENVELOPE FROM: mhtester@example.net ENVELOPE TO: <gray@example.net> - 0: X-Mailer: MH (AT_PACKAGE_NAME AT_PACKAGE_VERSION) - 1: Date: now - 2: From: mhtester@example.net - 3: To: <gray@example.net> - 4: Subject: Send file test + 0: From: mhtester@example.net + 1: To: <gray@example.net> + 2: Subject: Send file test + 3: Date: now + 4: X-Mailer: MH (GNU Mailutils 3.2.91) 5: 6: Message body END OF MESSAGE @@ -73,21 +73,21 @@ find . -name ',input.[[12]]' | sort [0], [ENVELOPE FROM: mhtester@example.net ENVELOPE TO: <gray@example.net> - 0: X-Mailer: MH (AT_PACKAGE_NAME AT_PACKAGE_VERSION) - 1: Date: now - 2: From: mhtester@example.net - 3: To: <gray@example.net> - 4: Subject: Send file test 1 + 0: From: mhtester@example.net + 1: To: <gray@example.net> + 2: Subject: Send file test 1 + 3: Date: now + 4: X-Mailer: MH (GNU Mailutils 3.2.91) 5: 6: Message body 1 END OF MESSAGE ENVELOPE FROM: mhtester@example.net ENVELOPE TO: <gray@example.org> - 0: X-Mailer: MH (AT_PACKAGE_NAME AT_PACKAGE_VERSION) - 1: Date: now - 2: From: mhtester@example.net - 3: To: <gray@example.org> - 4: Subject: Send file test 2 + 0: From: mhtester@example.net + 1: To: <gray@example.org> + 2: Subject: Send file test 2 + 3: Date: now + 4: X-Mailer: MH (AT_PACKAGE_NAME AT_PACKAGE_VERSION) 5: 6: Message body 2 END OF MESSAGE @@ -112,11 +112,11 @@ cat Mail/,draft [0], [ENVELOPE FROM: mhtester@example.net ENVELOPE TO: <gray@example.net> - 0: X-Mailer: MH (AT_PACKAGE_NAME AT_PACKAGE_VERSION) - 1: Date: now - 2: From: mhtester@example.net - 3: To: <gray@example.net> - 4: Subject: Send file test + 0: From: mhtester@example.net + 1: To: <gray@example.net> + 2: Subject: Send file test + 3: Date: now + 4: X-Mailer: MH (AT_PACKAGE_NAME AT_PACKAGE_VERSION) 5: 6: Message body END OF MESSAGE @@ -147,11 +147,11 @@ sed 's/: Date: .*/: Date: now/' $MTA_DIAG [0], [ENVELOPE FROM: mhtester@example.net ENVELOPE TO: <gray@example.net> - 0: X-Mailer: MH (AT_PACKAGE_NAME AT_PACKAGE_VERSION) - 1: Date: now - 2: From: mhtester@example.net - 3: To: <gray@example.net> - 4: Subject: Draftfolder test + 0: From: mhtester@example.net + 1: To: <gray@example.net> + 2: Subject: Draftfolder test + 3: Date: now + 4: X-Mailer: MH (AT_PACKAGE_NAME AT_PACKAGE_VERSION) 5: 6: Message body END OF MESSAGE @@ -184,11 +184,11 @@ sed 's/: Date: .*/: Date: now/' $MTA_DIAG [0], [ENVELOPE FROM: mhtester@example.net ENVELOPE TO: <gray@example.org> - 0: X-Mailer: MH (AT_PACKAGE_NAME AT_PACKAGE_VERSION) - 1: Date: now - 2: From: mhtester@example.net - 3: To: <gray@example.org> - 4: Subject: Draftmessage test + 0: From: mhtester@example.net + 1: To: <gray@example.org> + 2: Subject: Draftmessage test + 3: Date: now + 4: X-Mailer: MH (AT_PACKAGE_NAME AT_PACKAGE_VERSION) 5: 6: Message body END OF MESSAGE |