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) |
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 MHD_cleanup_sessions(struct MHD_Daemon * daemon) { struct MHD_Session * pos; struct MHD_Session * prev; + struct MHD_HTTP_Header * hpos; pos = daemon->connections; prev = NULL; @@ -283,8 +284,15 @@ MHD_cleanup_sessions(struct MHD_Daemon * daemon) { free(pos->write_buffer); if (pos->read_buffer != NULL) free(pos->read_buffer); - /* FIXME: free headers_received here! */ - /* FIXME: more to free here: response, more? */ + while (pos->headers_received != NULL) { + hpos = pos->headers_received; + pos->headers_received = hpos->next; + free(hpos->header); + free(hpos->value); + } + + if (pos->response != NULL) + MHD_destroy_response(pos->response); free(pos); } 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) { pos = pos->next; } /* produce data */ - data = malloc(size); + data = malloc(size + 1); memcpy(data, code, off); @@ -397,6 +397,9 @@ MHD_build_header_response(struct MHD_Session * session) { off += strlen(pos->header) + strlen(pos->value) + 4; pos = pos->next; } + sprintf(&data[off], + "\r\n"); + off += 2; if (off != size) abort(); session->write_buffer = data; |