[hackers] [quark] Send Accept-Ranges-header for file-requests || Laslo Hunhold

From: <git_AT_suckless.org>
Date: Thu, 23 Jul 2020 19:13:19 +0200 (CEST)

commit 5a7994bc61ce868521fc996e46006b61d07d23c4
Author: Laslo Hunhold <dev_AT_frign.de>
AuthorDate: Thu Jul 23 18:54:43 2020 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Thu Jul 23 18:54:43 2020 +0200

    Send Accept-Ranges-header for file-requests
    
    Now that the range-support is actually working, we can send out
    the Accept-Ranges-header so that clients know they can send
    range-requests to the server.
    
    This can be seen empirically when watching a video and skipping around
    into unbuffered space. Previously, it would not be possible and the
    time-selector would flip back to the furthest point the previous
    buffering had progressed. Now it is working flawlessly.
    
    Signed-off-by: Laslo Hunhold <dev_AT_frign.de>

diff --git a/resp.c b/resp.c
index 1716605..4c3d112 100644
--- a/resp.c
+++ b/resp.c
_AT_@ -190,7 +190,8 @@ resp_file(int fd, char *name, struct request *r, struct stat *st, char *mime,
                     "Connection: close\r\n"
                     "Last-Modified: %s\r\n"
                     "Content-Type: %s\r\n"
- "Content-Length: %zu\r\n",
+ "Content-Length: %zu\r\n"
+ "Accept-Ranges: bytes\r\n",
                     s, status_str[s], timestamp(time(NULL), t1),
                     timestamp(st->st_mtim.tv_sec, t2), mime,
                     upper - lower + 1) < 0) {
Received on Thu Jul 23 2020 - 19:13:19 CEST

This archive was generated by hypermail 2.3.0 : Thu Jul 23 2020 - 19:24:36 CEST