dovecot-2.2: lib-http: Don't free connection immediately in payl...
dovecot at dovecot.org
dovecot at dovecot.org
Sat Dec 1 02:41:46 EET 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/9cab24687819
changeset: 15440:9cab24687819
user: Timo Sirainen <tss at iki.fi>
date: Sat Dec 01 02:41:34 2012 +0200
description:
lib-http: Don't free connection immediately in payload-destroyed callback.
This caused a crash in http_client_connection_return_response() after the
stream was unrefed.
diffstat:
src/lib-http/http-client-connection.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diffs (40 lines):
diff -r f456fffeec5c -r 9cab24687819 src/lib-http/http-client-connection.c
--- a/src/lib-http/http-client-connection.c Thu Nov 29 10:29:19 2012 +0200
+++ b/src/lib-http/http-client-connection.c Sat Dec 01 02:41:34 2012 +0200
@@ -293,6 +293,16 @@
http_client_connection_input, &conn->conn);
}
+static void
+http_client_payload_destroyed_timeout(struct http_client_connection *conn)
+{
+ if (conn->close_indicated) {
+ http_client_connection_server_close(&conn);
+ return;
+ }
+ http_client_connection_input(&conn->conn);
+}
+
static void http_client_payload_destroyed(struct http_client_connection *conn)
{
i_assert(conn->incoming_payload != NULL);
@@ -310,18 +320,13 @@
http_client_request_finish(&conn->pending_request);
conn->pending_request = NULL;
- if (conn->close_indicated) {
- http_client_connection_server_close(&conn);
- return;
- }
-
/* input stream may have pending input. make sure input handler
gets called (but don't do it directly, since we get get here
somewhere from the API user's code, which we can't really know what
state it is in). this call also triggers sending a new request if
necessary. */
conn->to_input =
- timeout_add_short(0, http_client_connection_input, &conn->conn);
+ timeout_add_short(0, http_client_payload_destroyed_timeout, conn);
}
static bool
More information about the dovecot-cvs
mailing list