summaryrefslogtreecommitdiff
path: root/server/src/httpd.cc
diff options
context:
space:
mode:
authordeva <deva>2011-02-04 07:35:10 +0000
committerdeva <deva>2011-02-04 07:35:10 +0000
commit9ec9a98e83076bb339d1d546fa445b2420e5a4fb (patch)
treed507ac2dff3825719c6557a672ad8eb64c303e18 /server/src/httpd.cc
parente137415d0e0325d143b69a9917d8ebba411b3c12 (diff)
A new connection handling mechanism.
Diffstat (limited to 'server/src/httpd.cc')
-rw-r--r--server/src/httpd.cc11
1 files changed, 9 insertions, 2 deletions
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 <microhttpd.h>
+#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;
}