quark

quark web server
git clone git://git.suckless.org/quark
Log | Files | Refs | LICENSE

commit 9e9facc9bf884ccd95ef8341fd7dd61736796cb0
parent af61e37a3a282fb78a9f5ae308bb3f56d11d7406
Author: Laslo Hunhold <dev@frign.de>
Date:   Tue, 11 Jul 2017 12:33:21 +0200

Properly serve empty files

Diffstat:
quark.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/quark.c b/quark.c @@ -444,7 +444,8 @@ sendfile(int fd, char *name, struct request *r, struct stat *st, char *mime, "Content-Type: %s\r\n" "Content-Length: %zu\r\n", s, status_str[s], timestamp(time(NULL), t1), - timestamp(st->st_mtim.tv_sec, t2), mime, upper - lower + 1) < 0) { + timestamp(st->st_mtim.tv_sec, t2), mime, + upper - lower + (st->st_size > 0)) < 0) { s = S_REQUEST_TIMEOUT; goto cleanup; }