I'm embedding some static files into a Go binary as gzip-compressed
strings to be served over HTTP. I'm trying to figure out the proper
way of using http.ServeContent for this. When the client specifies
"gzip" in Accept-Encoding, all I need to do is set the
"Content-Encoding: gzip" header and send the data without any
additional processing.
I noticed, however, that when Content-Encoding is set,
http.ServeContent doesn't add the Content-Length header, even though
that information is available, and "chunked" Transfer-Encoding is used
instead. Is there a good reason for this? Here's the relevant code:
https://golang.org/src/net/http/fs.go#L249