remove any repeated '?', which hopefully will satisfy everybody.
Also:
- - Zimbra removes trailing spaces from IMAP BODY[HEADER], but not
- IMAP BODY[] or POP3 TOP. Just strip away all spaces with version 3.
-
+ - Zimbra removes trailing spaces and tabs from IMAP BODY[HEADER],
+ but not IMAP BODY[] or POP3 TOP. Just strip away all spaces with
+ version 3 and tabs also with version 4.
*/
for (i = start = 0; i < size; i++) {
bool cur_is_questionmark = FALSE;
switch (data[i]) {
case ' ':
- if (version == 3) {
+ if (version >= 3) {
/* strip away spaces */
method->loop(context, data + start, i-start);
start = i+1;
}
break;
case '\t':
+ if (version >= 4) {
+ /* strip away tabs */
+ method->loop(context, data + start, i-start);
+ start = i+1;
+ }
+ break;
case '\n':
break;
default:
#ifndef MESSAGE_HEADER_HASH_H
#define MESSAGE_HEADER_HASH_H
-#define MESSAGE_HEADER_HASH_MAX_VERSION 3
+#define MESSAGE_HEADER_HASH_MAX_VERSION 4
struct hash_method;
{ "? ? ? hi \x01\x02 \x03 ", 2, "? ? ? hi ? ? " },
{ test_input_with_nuls, 3, "?\t\n?!?x?yz?-plop?" },
- { "\n\nhi\n\n", 2, "\n\nhi\n\n" },
+ { "\n\nhi\n\n", 3, "\n\nhi\n\n" },
{ "", 3, "" },
{ " ", 3, "" },
{ " ", 3, "" },
{ " ? ", 3, "?" },
{ "? ? ? hi \x01\x02 \x03 ", 3, "???hi??" },
+ { " \t \t", 3, "\t\t" },
+
+ { test_input_with_nuls, 4, "?\n?!?x?yz?-plop?" },
+ { "\n\nhi\n\n", 4, "\n\nhi\n\n" },
+ { "", 4, "" },
+ { " ", 4, "" },
+ { " \t \t", 4, "" },
+ { "foo\t\t", 4, "foo" },
};
static void test_message_header_hash_more(void)