request: ignore empty request in log
This commit is contained in:
parent
73d8b456eb
commit
68f51ac37a
1 changed files with 4 additions and 1 deletions
5
quark.c
5
quark.c
|
@ -458,6 +458,8 @@ request(void) {
|
||||||
logerrmsg("error\tread: %s\n", strerror(errno));
|
logerrmsg("error\tread: %s\n", strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if(offset == 0)
|
||||||
|
return -2; /* empty request, ignore in log */
|
||||||
|
|
||||||
/* extract host and mod */
|
/* extract host and mod */
|
||||||
if (getreqentry("Host:", reqhost, LENGTH(reqhost), " \t\r\n") != 0)
|
if (getreqentry("Host:", reqhost, LENGTH(reqhost), " \t\r\n") != 0)
|
||||||
|
@ -538,7 +540,8 @@ serve(int fd) {
|
||||||
status = -1;
|
status = -1;
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
response();
|
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);
|
shutdown(req.fd, SHUT_WR);
|
||||||
close(req.fd);
|
close(req.fd);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
|
Loading…
Reference in a new issue