From 9ec9a98e83076bb339d1d546fa445b2420e5a4fb Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 4 Feb 2011 07:35:10 +0000 Subject: A new connection handling mechanism. --- server/src/httpd.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'server/src/httpd.cc') diff --git a/server/src/httpd.cc b/server/src/httpd.cc index e47cefc..ce1a1ce 100644 --- a/server/src/httpd.cc +++ b/server/src/httpd.cc @@ -39,6 +39,8 @@ #include +#include "debug.h" + typedef struct { void *ptr; bool firstrun; @@ -48,6 +50,8 @@ typedef struct { int hdit(void *cls, enum MHD_ValueKind kind, const char *key, const char *value) { + DEBUG(httpd, "%s: %s\n", key, value); + headers_t *headers = (headers_t*)cls; (*headers)[key] = value; @@ -70,8 +74,11 @@ static int request_handler(void *cls, if(*con_cls == NULL) { headers_t headers; + headers_t getargs; - MHD_get_connection_values(con, MHD_HEADER_KIND, hdit, &headers); + MHD_get_connection_values(con, MHD_HEADER_KIND, &hdit, &headers); + int n = MHD_get_connection_values(con, MHD_GET_ARGUMENT_KIND, &hdit, &getargs); + DEBUG(httpd, "Num args: %d\n", n); connection_t* c = new connection_t; @@ -81,7 +88,7 @@ static int request_handler(void *cls, c->total = atoi(headers["Content-Length"].c_str()); } c->acc = 0; - c->ptr = httpd->begin(url, method, version, headers); + c->ptr = httpd->begin(url, method, version, getargs, headers); *con_cls = c; } -- cgit v1.2.3