changeset 20256:53d27b48c606

lib-http: server: Fixed assert failure occurring when closing the connection while a request payload was still being read.
author Stephan Bosch <stephan@rename-it.nl>
date Sat, 30 Apr 2016 14:22:21 +0200
parents 8ccdc8b81cd5
children 7e6d01439d76
files src/lib-http/http-server-connection.c
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-http/http-server-connection.c	Sat Apr 30 15:26:27 2016 +0300
+++ b/src/lib-http/http-server-connection.c	Sat Apr 30 14:22:21 2016 +0200
@@ -1062,6 +1062,13 @@
 	/* preserve statistics */
 	http_server_connection_update_stats(conn);
 
+	if (conn->incoming_payload != NULL) {
+		/* the stream is still accessed by lib-http caller. */
+		i_stream_remove_destroy_callback(conn->incoming_payload,
+						 http_server_payload_destroyed);
+		conn->incoming_payload = NULL;
+	}
+
 	/* drop all requests before connection is closed */
 	req = conn->request_queue_head;
 	while (req != NULL) {
@@ -1081,13 +1088,6 @@
 		o_stream_uncork(conn->conn.output);
 	}
 
-	if (conn->incoming_payload != NULL) {
-		/* the stream is still accessed by lib-http caller. */
-		i_stream_remove_destroy_callback(conn->incoming_payload,
-						 http_server_payload_destroyed);
-		conn->incoming_payload = NULL;
-	}
-
 	if (conn->http_parser != NULL)
 		http_request_parser_deinit(&conn->http_parser);
 	connection_disconnect(&conn->conn);