From: Stephan Bosch Date: Sat, 30 Apr 2016 12:22:21 +0000 (+0200) Subject: lib-http: server: Fixed assert failure occurring when closing the connection while... X-Git-Tag: 2.3.0.rc1~3876 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0a6d1a48c7649f47ded69c550f45357201e7bdec;p=thirdparty%2Fdovecot%2Fcore.git lib-http: server: Fixed assert failure occurring when closing the connection while a request payload was still being read. --- diff --git a/src/lib-http/http-server-connection.c b/src/lib-http/http-server-connection.c index 6e166817e3..ce0ee5be64 100644 --- a/src/lib-http/http-server-connection.c +++ b/src/lib-http/http-server-connection.c @@ -1092,6 +1092,13 @@ http_server_connection_disconnect(struct http_server_connection *conn, /* 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) { @@ -1111,13 +1118,6 @@ http_server_connection_disconnect(struct http_server_connection *conn, 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);