rpc: enable compression on HTTP transport (#19997)

This change adds support for gzip encoding on HTTP responses.
Gzip encoding is used when the client sets the 'accept-encoding: gzip' header.
Original change by @brianosaurus, with fixes from @SjonHortensius.
This commit is contained in:
SjonHortensius
2019-08-22 15:18:39 +02:00
committed by Felix Lange
parent 54b271a86d
commit 961aa0533f
2 changed files with 67 additions and 0 deletions

View File

@ -216,6 +216,7 @@ func NewHTTPServer(cors []string, vhosts []string, timeouts HTTPTimeouts, srv ht
// Wrap the CORS-handler within a host-handler
handler := newCorsHandler(srv, cors)
handler = newVHostHandler(vhosts, handler)
handler = newGzipHandler(handler)
// Make sure timeout values are meaningful
if timeouts.ReadTimeout < time.Second {