Open richardschneider opened 6 years ago
If anyone wants to help with this:
This would likely be useful for our public gateways. However, it significantly impacts the performance of a local gateway/API (like, 14x+ slowdown).
package corehttp
import (
"github.com/NYTimes/gziphandler"
"net"
"net/http"
core "github.com/ipfs/go-ipfs/core"
)
func CompressOption() ServeOption {
return func(n *core.IpfsNode, _ net.Listener, mux *http.ServeMux) (*http.ServeMux, error) {
childMux := http.NewServeMux()
mux.Handle("/", gziphandler.GzipHandler(childMux))
return childMux, nil
}
}
Version information:
go-ipfs version: 0.4.11- Repo version: 6 System version: amd64/windows Golang version: go1.9
Type: Enhancement
Description:
Compressing the response from the server can lower bandwidth requirements, especially when transferring large blocks.
The HTTP header
Accept-Encoding: gzip
should be accepted in a request. The server should then send a compressed response withContent-Encoding: gzip