Commit Graph

1 Commits (f1be7b04d40ff5967cbd3e72cacb041700ad9cce)

Author SHA1 Message Date
James Tucker 08a34edd91
tsweb: add transparent compression for StdHandler
Implements inline compression for both gzip and brotli via the brotli
library. The library requires that Content-Type is set. The
implementation here explicitly avoids wrapping the ResponseWriter in
cases where Accept-Encoding is not set so as to maximally attempt to get
out of the way of hijack and upgrade concerns. It also avoids any
attempt at compression if Content-Encoding is already set so that
handlers that already perform compression are unaffected.

Signed-off-by: James Tucker <james@tailscale.com>
2022-11-30 13:49:04 -08:00