[hackers] [quark] Properly serve empty files || Laslo Hunhold

From: <git_AT_suckless.org>
Date: Tue, 11 Jul 2017 12:33:32 +0200 (CEST)

commit 9e9facc9bf884ccd95ef8341fd7dd61736796cb0
Author: Laslo Hunhold <dev_AT_frign.de>
AuthorDate: Tue Jul 11 12:33:21 2017 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
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
_AT_@ -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;
         }
Received on Tue Jul 11 2017 - 12:33:32 CEST

This archive was generated by hypermail 2.3.0 : Tue Jul 11 2017 - 12:37:21 CEST