From: Stephan Bosch Date: Mon, 8 Feb 2016 21:57:13 +0000 (+0100) Subject: lib-http: message parser: Made sure that payload stream is always destroyed (hence... X-Git-Tag: 2.2.22.rc1~187 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9a07da094849cc665628c60db3024446fb71bae3;p=thirdparty%2Fdovecot%2Fcore.git lib-http: message parser: Made sure that payload stream is always destroyed (hence closed) when the next request is to be parsed. This makes sure that the connection input is always at the correct position for the next request. Remaining references to the payload stream could theoretically mess this up. --- diff --git a/src/lib-http/http-message-parser.c b/src/lib-http/http-message-parser.c index ef70dc49fd..b0e1724075 100644 --- a/src/lib-http/http-message-parser.c +++ b/src/lib-http/http-message-parser.c @@ -121,7 +121,8 @@ int http_message_parse_finish_payload(struct http_message_parser *parser) } return ret; } - i_stream_unref(&parser->payload); + + i_stream_destroy(&parser->payload); return 1; } @@ -404,6 +405,8 @@ int http_message_parse_body(struct http_message_parser *parser, bool request) { struct istream *input; + i_assert(parser->payload == NULL); + parser->error_code = HTTP_MESSAGE_PARSE_ERROR_NONE; parser->error = NULL;