Efficient serving of pre-compressed static files.
Go to file
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
cmd packserver: use htpack v1.1.1 2019-05-10 13:22:53 +01:00
packed Reorganise ready to split into modules 2019-04-12 09:07:17 +01:00
.gitignore Finish up the initial packserver implementation 2019-04-15 14:10:26 +01:00
README.md Note a TODO in the README 2019-04-12 09:16:23 +01:00
go.mod Update dependencies 2019-04-15 14:15:43 +01:00
go.sum Update dependencies 2019-04-15 14:15:43 +01:00
handler.go handler: fix sendfile to be non-blocking 2019-05-28 12:57:59 +01:00

README.md

HTTP resource pack server

A common scenario is that you have a set of static resources that you want to serve up quickly via HTTP (for example: stylesheets, WASM).

This package provides a net/http-compatible http.Handler to do so, with support for:

  • compression
    • gzip
    • brotli, if you have the external compression binary available at pack time
    • does not yet support Transfer-Encoding, only Accept-Encoding/Content-Encoding
  • etags
  • ranges (TODO)

The workflow is as follows:

  • (optional) build YAML file describing files to serve
  • run htpacker tool to produce a single .htpack file
  • create htpack.Handler pointing at .htpack file

The handler can easily be combined with middleware (http.StripPrefix etc.).