changeset 19733:cf333b33c3ef

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.
author Stephan Bosch <stephan@rename-it.nl>
date Mon, 08 Feb 2016 22:57:13 +0100
parents 535b6ed4d9ea
children b5fcfa9ab945
files src/lib-http/http-message-parser.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-http/http-message-parser.c	Mon Feb 08 22:55:09 2016 +0100
+++ b/src/lib-http/http-message-parser.c	Mon Feb 08 22:57:13 2016 +0100
@@ -121,7 +121,8 @@
 		}
 		return ret;
 	}
-	i_stream_unref(&parser->payload);
+
+	i_stream_destroy(&parser->payload);
 	return 1;
 }
 
@@ -404,6 +405,8 @@
 {
 	struct istream *input;
 
+	i_assert(parser->payload == NULL);
+
 	parser->error_code = HTTP_MESSAGE_PARSE_ERROR_NONE;
 	parser->error = NULL;