# HG changeset patch # User Stephan Bosch # Date 1462018941 -7200 # Node ID 53d27b48c606b99d9ff31c678baf428f40c648b6 # Parent 8ccdc8b81cd5a70a979524ba94cf464d94d0fd08 lib-http: server: Fixed assert failure occurring when closing the connection while a request payload was still being read. diff -r 8ccdc8b81cd5 -r 53d27b48c606 src/lib-http/http-server-connection.c --- 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);