commit 9e9facc9bf884ccd95ef8341fd7dd61736796cb0
Author:     Laslo Hunhold <[email protected]>
AuthorDate: Tue Jul 11 12:33:21 2017 +0200
Commit:     Laslo Hunhold <[email protected]>
CommitDate: Tue Jul 11 12:33:21 2017 +0200

    Properly serve empty files

diff --git a/quark.c b/quark.c
index 2a836b0..67b696a 100644
--- 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;
        }

Reply via email to