Fix sending of zero-size files
This commit is contained in:
parent
432898af71
commit
b04ba86f9d
1 changed files with 3 additions and 3 deletions
6
quark.c
6
quark.c
|
@ -454,13 +454,13 @@ sendfile(int fd, char *name, struct request *r, struct stat *st, char *mime,
|
||||||
"Content-Length: %zu\r\n",
|
"Content-Length: %zu\r\n",
|
||||||
s, status_str[s], timestamp(time(NULL), t1),
|
s, status_str[s], timestamp(time(NULL), t1),
|
||||||
timestamp(st->st_mtim.tv_sec, t2), mime,
|
timestamp(st->st_mtim.tv_sec, t2), mime,
|
||||||
upper - lower + (st->st_size > 0)) < 0) {
|
upper - lower + 1) < 0) {
|
||||||
s = S_REQUEST_TIMEOUT;
|
s = S_REQUEST_TIMEOUT;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (range) {
|
if (range) {
|
||||||
if (dprintf(fd, "Content-Range: bytes %zu-%zu/%zu\r\n",
|
if (dprintf(fd, "Content-Range: bytes %zd-%zd/%zu\r\n",
|
||||||
lower, upper, st->st_size) < 0) {
|
lower, upper + (upper < 0), st->st_size) < 0) {
|
||||||
s = S_REQUEST_TIMEOUT;
|
s = S_REQUEST_TIMEOUT;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue