Mercurial > dovecot > core-2.2
changeset 21558:390c3ef87cc8
lib-http: message parser: Delay allocation of message header.
author | Stephan Bosch <stephan.bosch@dovecot.fi> |
---|---|
date | Sat, 04 Feb 2017 14:11:36 +0100 |
parents | 219ec946f7c3 |
children | 7163fa58c41e |
files | src/lib-http/http-message-parser.c |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-http/http-message-parser.c Sat Feb 04 14:03:25 2017 +0100 +++ b/src/lib-http/http-message-parser.c Sat Feb 04 14:11:36 2017 +0100 @@ -61,7 +61,6 @@ pool_ref(pool); } parser->msg.date = (time_t)-1; - parser->msg.header = http_header_create(parser->msg.pool, 32); } int http_message_parse_version(struct http_message_parser *parser) @@ -132,6 +131,8 @@ const struct http_header_field *hdr; struct http_parser hparser; + if (parser->msg.header == NULL) + parser->msg.header = http_header_create(parser->msg.pool, 32); hdr = http_header_field_add(parser->msg.header, name, data, size); /* RFC 7230, Section 3.2.2: Field Order @@ -356,6 +357,10 @@ if (field_name == NULL) { /* EOH */ + /* Create empty header if there is none */ + if (parser->msg.header == NULL) + parser->msg.header = http_header_create(parser->msg.pool, 1); + /* handle HTTP/1.0 persistence */ if (msg->version_major == 1 && msg->version_minor == 0 && !msg->connection_close) {