[hackers] [quark] request: ignore empty request in log || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Mon, 25 Aug 2014 00:32:28 +0200

commit 68f51ac37af761e64c1854ea7d4a4bebc83897e7
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Sun Aug 24 23:02:03 2014 +0000

    request: ignore empty request in log

diff --git a/quark.c b/quark.c
index a1a1462..bf5fd10 100644
--- a/quark.c
+++ b/quark.c
_AT_@ -458,6 +458,8 @@ request(void) {
                 logerrmsg("error read: %s
", strerror(errno));
                 return -1;
         }
+ if(offset == 0)
+ return -2; /* empty request, ignore in log */
 
         /* extract host and mod */
         if (getreqentry("Host:", reqhost, LENGTH(reqhost), "
") != 0)
_AT_@ -538,7 +540,8 @@ serve(int fd) {
                         status = -1;
                         if (result == 0)
                                 response();
- logmsg("%d %s %s
", status, host, reqbuf);
+ if(result != -2)
+ logmsg("%d %s %s
", status, host, status == -1 ? "" : reqbuf);
                         shutdown(req.fd, SHUT_WR);
                         close(req.fd);
                         exit(EXIT_SUCCESS);
Received on Mon Aug 25 2014 - 00:32:28 CEST

This archive was generated by hypermail 2.3.0 : Mon Aug 25 2014 - 00:36:23 CEST