quark

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

commit 432898af71af69203f2fa33aa604f0461206e49a
parent 64e7dc3fdaabb47446eeb04e2d7849f91add26e5
Author: Quentin Rameau <quinq@fifth.space>
Date:   Sat, 22 Jul 2017 00:07:23 +0200

Adjust last-byte-pos greater than files

Diffstat:
quark.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/quark.c b/quark.c @@ -721,8 +721,7 @@ sendresponse(int fd, struct request *r) } /* check range */ - if (lower < 0 || upper < 0 || lower > upper || - upper >= st.st_size) { + if (lower < 0 || upper < 0 || lower > upper) { if (dprintf(fd, "HTTP/1.1 %d %s\r\n" "Date: %s\r\n" @@ -737,6 +736,10 @@ sendresponse(int fd, struct request *r) } return S_RANGE_NOT_SATISFIABLE; } + + /* adjust upper limit */ + if (upper >= st.st_size) + upper = st.st_size-1; } /* mime */