message-header-parser.c revision f16712057c1b82c6d2a3a4267c4521d357cd4b4c
7a7d97c082834dccdd89dbb95598977deec4d5a7Timo Sirainen/* Copyright (c) 2002-2009 Dovecot authors, see the included COPYING file */
7a7d97c082834dccdd89dbb95598977deec4d5a7Timo Sirainenmessage_parse_header_init(struct istream *input, struct message_size *hdr_size,
7a7d97c082834dccdd89dbb95598977deec4d5a7Timo Sirainen ctx = i_new(struct message_header_parser_ctx, 1);
7a7d97c082834dccdd89dbb95598977deec4d5a7Timo Sirainen ctx->value_buf = buffer_create_dynamic(default_pool, 4096);
7a7d97c082834dccdd89dbb95598977deec4d5a7Timo Sirainenvoid message_parse_header_deinit(struct message_header_parser_ctx **_ctx)
7a7d97c082834dccdd89dbb95598977deec4d5a7Timo Sirainen struct message_header_parser_ctx *ctx = *_ctx;
7a7d97c082834dccdd89dbb95598977deec4d5a7Timo Sirainenint message_parse_header_next(struct message_header_parser_ctx *ctx,
const unsigned char *msg;
int ret;
colon_pos = 0;
for (startpos = 0;;) {
if (ret >= 0) {
if (startpos > 0) {
size = 0;
size--;
startpos = 0;
size = i;
colon_pos = i;
i = startpos;
for (; i < parse_size; i++) {
if (i < parse_size) {
startpos = 0;
size = i;
startpos = i;
if (size == 0) {
colon_pos--;
if (last_no_newline) {
if (last_crlf)
int ret;