Skip to content

Commit

Permalink
lib-http: server: Fixed assert failure occurring when closing the con…
Browse files Browse the repository at this point in the history
…nection while a request payload was still being read.
  • Loading branch information
stephanbosch authored and sirainen committed Jun 14, 2016
1 parent 5c33861 commit 273ed7a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/lib-http/http-server-connection.c
Expand Up @@ -1062,6 +1062,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) {
Expand All @@ -1081,13 +1088,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);
Expand Down

0 comments on commit 273ed7a

Please sign in to comment.