From 68f51ac37af761e64c1854ea7d4a4bebc83897e7 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sun, 24 Aug 2014 23:02:03 +0000 Subject: [PATCH] request: ignore empty request in log --- quark.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/quark.c b/quark.c index a1a1462..bf5fd10 100644 --- a/quark.c +++ b/quark.c @@ -458,6 +458,8 @@ request(void) { logerrmsg("error\tread: %s\n", strerror(errno)); return -1; } + if(offset == 0) + return -2; /* empty request, ignore in log */ /* extract host and mod */ if (getreqentry("Host:", reqhost, LENGTH(reqhost), " \t\r\n") != 0) @@ -538,7 +540,8 @@ serve(int fd) { status = -1; if (result == 0) response(); - logmsg("%d\t%s\t%s\n", status, host, reqbuf); + if(result != -2) + logmsg("%d\t%s\t%s\n", status, host, status == -1 ? "" : reqbuf); shutdown(req.fd, SHUT_WR); close(req.fd); exit(EXIT_SUCCESS);