diff -r 74d21dd5fd5d -r 8b85c5face66 src/server/daemon/sessionhandler.c --- a/src/server/daemon/sessionhandler.c Sat Jan 21 15:31:17 2017 +0100 +++ b/src/server/daemon/sessionhandler.c Sat Jan 21 16:40:59 2017 +0100 @@ -42,6 +42,7 @@ typedef struct _event_http_io { HTTPRequest *request; HttpParser *parser; + int error; } EventHttpIO; @@ -212,6 +213,7 @@ } io->request = request; io->parser = parser; + io->error = 0; /* * to start the request handling, we begin with a poll on the socket, @@ -222,6 +224,7 @@ event_handler_t *ev = ((EventSessionHandler*)handler)->eventhandler; event_t *event = malloc(sizeof(event_t)); + ZERO(event, sizeof(event_t)); event->fn = evt_request_input; event->finish = evt_request_finish; event->cookie = io; @@ -263,6 +266,7 @@ } event->finish = evt_request_error; + io->error = 1; return 0; } //fwrite(buf->inbuf + buf->pos, 1, r, stdout); @@ -274,6 +278,7 @@ // parse error fatal_error(request, 400); event->finish = evt_request_error; + io->error = 2; return 0; } else if(state == 1) { /* @@ -294,6 +299,7 @@ if (fcntl(request->connection->fd, F_SETFL, flags & ~O_NONBLOCK) != 0) { // just close the connection if fcntl fails event->finish = evt_request_error; + io->error = 3; return 0; } @@ -332,11 +338,15 @@ return 0; } -int evt_request_error(event_handler_t *h, event_t *event) { +int evt_request_error(event_handler_t *h, event_t *event) { EventHttpIO *io = event->cookie; HttpParser *parser = io->parser; HTTPRequest *request = io->request; + if(event->error) { + log_ereport(LOG_VERBOSE, "sessionhandler http io error: %d", io->error); + } + free(request->netbuf->inbuf); free(request->netbuf);