dovecot-2.2: lib-http: server: Added assert to connect callback ...

dovecot at dovecot.org dovecot at dovecot.org
Wed Sep 10 10:44:44 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/b7c29e47b0f6
changeset: 17770:b7c29e47b0f6
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Wed Sep 10 13:39:37 2014 +0300
description:
lib-http: server: Added assert to connect callback which makes sure request is either responded to or referenced.
Earlier change added this only to callback for normal requests, but CONNECT should be handled the same in this respect.

diffstat:

 src/lib-http/http-server-connection.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (34 lines):

diff -r 0f1878544d3b -r b7c29e47b0f6 src/lib-http/http-server-connection.c
--- a/src/lib-http/http-server-connection.c	Wed Sep 10 13:39:37 2014 +0300
+++ b/src/lib-http/http-server-connection.c	Wed Sep 10 13:39:37 2014 +0300
@@ -244,6 +244,8 @@
 static void http_server_connection_request_callback(
 	struct http_server_connection *conn, struct http_server_request *req)
 {
+	unsigned int old_refcount = req->refcount;
+
 	/* CONNECT method */
 	if (strcmp(req->req.method, "CONNECT") == 0) {
 		if (conn->callbacks->handle_connect_request == NULL) {
@@ -262,15 +264,13 @@
 		if (conn->callbacks->handle_request == NULL) {
 			http_server_request_fail(req, 505, "Not Implemented");
 			return;
-		} else {
-			unsigned int old_refcount = req->refcount;
+		}
+		conn->callbacks->handle_request(conn->context, req);
+	}
 
-			conn->callbacks->handle_request(conn->context, req);
-			i_assert((req->response != NULL &&
-				  req->response->submitted) ||
-				 req->refcount > old_refcount);
-		}
-	}
+	i_assert((req->response != NULL &&
+		  req->response->submitted) ||
+		 req->refcount > old_refcount);
 }
 
 static bool


More information about the dovecot-cvs mailing list