Skip to content

Commit

Permalink
lib-mail: Remove MESSAGE_HEADER_REPLACE_NULS_WITH_0x80 flag
Browse files Browse the repository at this point in the history
As mentioned in previous commit, 0x80 isn't valid UTF-8 and we shouldn't
encourage using it. This implementation also can't be easily changed to
use unicode replacement character without larger changes to istream-nonuls.

Reverts 95fba2c.
  • Loading branch information
sirainen committed Aug 30, 2018
1 parent a5875be commit 8fd288a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
9 changes: 2 additions & 7 deletions src/lib-mail/message-header-parser.c
Expand Up @@ -3,7 +3,6 @@
#include "lib.h"
#include "buffer.h"
#include "istream.h"
#include "istream-nonuls.h"
#include "str.h"
#include "message-size.h"
#include "message-header-parser.h"
Expand All @@ -29,16 +28,12 @@ message_parse_header_init(struct istream *input, struct message_size *hdr_size,
struct message_header_parser_ctx *ctx;

ctx = i_new(struct message_header_parser_ctx, 1);
if ((flags & MESSAGE_HEADER_REPLACE_NULS_WITH_0x80) != 0)
ctx->input = i_stream_create_nonuls(input, 0x80);
else {
ctx->input = input;
i_stream_ref(input);
}
ctx->input = input;
ctx->hdr_size = hdr_size;
ctx->name = str_new(default_pool, 128);
ctx->flags = flags;
ctx->value_buf = buffer_create_dynamic(default_pool, 4096);
i_stream_ref(input);

if (hdr_size != NULL)
i_zero(hdr_size);
Expand Down
4 changes: 1 addition & 3 deletions src/lib-mail/message-header-parser.h
Expand Up @@ -13,9 +13,7 @@ enum message_header_parser_flags {
/* Don't add CRs to full_value even if input had them */
MESSAGE_HEADER_PARSER_FLAG_DROP_CR = 0x02,
/* Convert [CR+]LF+LWSP to a space character in full_value */
MESSAGE_HEADER_PARSER_FLAG_CLEAN_ONELINE = 0x04,
/* Replace 0x0 symbols with 0x80 */
MESSAGE_HEADER_REPLACE_NULS_WITH_0x80 = 0x08,
MESSAGE_HEADER_PARSER_FLAG_CLEAN_ONELINE = 0x04
};

struct message_header_line {
Expand Down

0 comments on commit 8fd288a

Please sign in to comment.