From 0066dc88e7a00917230aaa636d2df6535fe15276 Mon Sep 17 00:00:00 2001 From: deva Date: Wed, 4 Nov 2009 14:44:05 +0000 Subject: Fixed error in connection callback function. --- server/src/server.cc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/server/src/server.cc b/server/src/server.cc index a94cca3..d9b28a9 100644 --- a/server/src/server.cc +++ b/server/src/server.cc @@ -341,8 +341,10 @@ static int handle_request(void *cls, unsigned int *data_size, void **ptr) { - PRACRO_DEBUG(httpd, "handle_request(url=\"%s\", method=\"%s\", version=\"%s\", data_size=\"%d\")\n", - url, method, version, *data_size); + PRACRO_DEBUG(httpd, + "handle_request(url=\"%s\", method=\"%s\"," + " version=\"%s\", data_size=\"%d\")\n", + url, method, version, *data_size); std::string reply = handleConnection((char*)data, *data_size); @@ -351,7 +353,9 @@ static int handle_request(void *cls, MHD_add_response_header(rsp, MHD_HTTP_HEADER_CONTENT_TYPE, "text/plain; charset=UTF-8"); int ret = MHD_queue_response(con, MHD_HTTP_OK, rsp); MHD_destroy_response(rsp); - + + *data_size = 0; + return ret; } @@ -401,7 +405,11 @@ void server() PRACRO_DEBUG(server, "Server running on port %d.\n", port); struct MHD_Daemon *d; - d = MHD_start_daemon(MHD_USE_DEBUG | MHD_USE_SELECT_INTERNALLY, // | MHD_USE_SSL, + d = MHD_start_daemon(MHD_USE_DEBUG + | MHD_USE_SELECT_INTERNALLY + // | MHD_USE_PEDANTIC_CHECKS + // | MHD_USE_SSL + , port, NULL, NULL, handle_request, NULL, @@ -409,7 +417,7 @@ void server() // MHD_OPTION_CONNECTION_LIMIT, 42, MHD_OPTION_HTTPS_MEM_KEY, KEY, MHD_OPTION_HTTPS_MEM_CERT, CERT, - MHD_OPTION_CONNECTION_TIMEOUT, 0, + //MHD_OPTION_CONNECTION_TIMEOUT, 0, MHD_OPTION_EXTERNAL_LOGGER, httpderr, NULL, MHD_OPTION_END); -- cgit v1.2.3