Commit Graph

9 Commits

Author SHA1 Message Date
Laurence Withers f7cd22f633 Single range support
We now support single part ranges, as per:

https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests#Single_part_ranges

Multi-part ranges are not implemented because there have been far too
many bugs in this area.

It interacts with compression by selecting a byte range from the
compressed stream. Since the compressed stream is fixed, the results are
consistent.
2019-10-09 13:04:07 +01:00
Laurence Withers b7b5dd55d0 Remove stray debug printf 2019-07-17 16:30:20 +01:00
Laurence Withers c2d7bdaa71 handler: fix sendfile to be non-blocking
Having done a bit more research on exactly how to use sendfile()
effectively with Go's own event loop, we can now leave the HTTP socket
in non-blocking mode and correctly integrate with the event loop to wait
for the socket to be writeable once more.
2019-05-28 12:57:59 +01:00
Laurence Withers eac79eb605 Set blocking mode on hijacked fds for sendfile 2019-05-10 13:21:22 +01:00
Laurence Withers be86cbaed3 Handler: add SetIndex
This allows setting an index.html (or equivalent) filename; this means that
we can serve requests to "/foo" with the contents of "/foo/index.html".
2019-04-25 14:17:55 +01:00
Laurence Withers fdd1990e89 Reorganise ready to split into modules 2019-04-12 09:07:17 +01:00
Laurence Withers feb25bf276 Handler: close TCP conn after Sendfile
Since we hijacked the HTTP connection, we need to close the underlying TCP
connection after calling Sendfile.
2019-03-29 09:17:46 +00:00
Laurence Withers d42094ea72 Handler: call path.Clean first
Cope with things like /foo//bar by calling path.Clean before searching for
path in the map.
2019-03-29 09:17:15 +00:00
Laurence Withers 2a25d80249 Handler implementation
Currently missing range support, but compression and etag processing is
in along with basic header support. Still needs unit tests.
2019-03-08 09:16:38 +00:00