diff options
author | Christian Grothoff <christian@grothoff.org> | 2007-06-13 07:25:11 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2007-06-13 07:25:11 +0000 |
commit | 299b28f1316ed69b4db0174adc9166fac55b8ecc (patch) | |
tree | 2dc8d54bc91098977ba94050fc9d553b28d3bea2 | |
parent | 67b4004e738e976179272da7e254f6b72887bc94 (diff) | |
download | libmicrohttpd-299b28f1316ed69b4db0174adc9166fac55b8ecc.tar.gz libmicrohttpd-299b28f1316ed69b4db0174adc9166fac55b8ecc.zip |
added essential logging
-rw-r--r-- | src/daemon/daemon.c | 12 | ||||
-rw-r--r-- | src/daemon/session.c | 5 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index 3935832e..2a2636db 100644 --- a/src/daemon/daemon.c +++ b/src/daemon/daemon.c | |||
@@ -265,6 +265,7 @@ static void | |||
265 | MHD_cleanup_sessions(struct MHD_Daemon * daemon) { | 265 | MHD_cleanup_sessions(struct MHD_Daemon * daemon) { |
266 | struct MHD_Session * pos; | 266 | struct MHD_Session * pos; |
267 | struct MHD_Session * prev; | 267 | struct MHD_Session * prev; |
268 | struct MHD_HTTP_Header * hpos; | ||
268 | 269 | ||
269 | pos = daemon->connections; | 270 | pos = daemon->connections; |
270 | prev = NULL; | 271 | prev = NULL; |
@@ -283,8 +284,15 @@ MHD_cleanup_sessions(struct MHD_Daemon * daemon) { | |||
283 | free(pos->write_buffer); | 284 | free(pos->write_buffer); |
284 | if (pos->read_buffer != NULL) | 285 | if (pos->read_buffer != NULL) |
285 | free(pos->read_buffer); | 286 | free(pos->read_buffer); |
286 | /* FIXME: free headers_received here! */ | 287 | while (pos->headers_received != NULL) { |
287 | /* FIXME: more to free here: response, more? */ | 288 | hpos = pos->headers_received; |
289 | pos->headers_received = hpos->next; | ||
290 | free(hpos->header); | ||
291 | free(hpos->value); | ||
292 | } | ||
293 | |||
294 | if (pos->response != NULL) | ||
295 | MHD_destroy_response(pos->response); | ||
288 | free(pos); | 296 | free(pos); |
289 | } | 297 | } |
290 | prev = pos; | 298 | prev = pos; |
diff --git a/src/daemon/session.c b/src/daemon/session.c index b458cad7..62e05edd 100644 --- a/src/daemon/session.c +++ b/src/daemon/session.c | |||
@@ -384,7 +384,7 @@ MHD_build_header_response(struct MHD_Session * session) { | |||
384 | pos = pos->next; | 384 | pos = pos->next; |
385 | } | 385 | } |
386 | /* produce data */ | 386 | /* produce data */ |
387 | data = malloc(size); | 387 | data = malloc(size + 1); |
388 | memcpy(data, | 388 | memcpy(data, |
389 | code, | 389 | code, |
390 | off); | 390 | off); |
@@ -397,6 +397,9 @@ MHD_build_header_response(struct MHD_Session * session) { | |||
397 | off += strlen(pos->header) + strlen(pos->value) + 4; | 397 | off += strlen(pos->header) + strlen(pos->value) + 4; |
398 | pos = pos->next; | 398 | pos = pos->next; |
399 | } | 399 | } |
400 | sprintf(&data[off], | ||
401 | "\r\n"); | ||
402 | off += 2; | ||
400 | if (off != size) | 403 | if (off != size) |
401 | abort(); | 404 | abort(); |
402 | session->write_buffer = data; | 405 | session->write_buffer = data; |