Chore: update gzipping library to use CAFxX/httpcompression (#2741)

* chore: replace nanmu/gzip by CAFxX/httpcompression for compression

Instead of using nanmu42/gzip which imports the whole gin framework,
we replace it with CAFxX/httpcompression which is more lightweight.

Fixes #2697

* Run go mod tidy

---------

Co-authored-by: Gabe Kangas <gabek@real-ity.com>
This commit is contained in:
Pranav Joglekar
2023-02-27 01:49:17 +05:30
committed by GitHub
parent 254b2d5fc0
commit d76875d2de
3 changed files with 19 additions and 81 deletions

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"time"
"github.com/nanmu42/gzip"
"github.com/CAFxX/httpcompression"
"github.com/prometheus/client_golang/prometheus/promhttp"
log "github.com/sirupsen/logrus"
"golang.org/x/net/http2"
@@ -419,10 +419,11 @@ func Start() error {
}
})
compress, _ := httpcompression.DefaultAdapter() // Use the default configuration
server := &http.Server{
Addr: fmt.Sprintf("%s:%d", ip, port),
ReadHeaderTimeout: 4 * time.Second,
Handler: gzip.DefaultHandler().WrapHandler(m),
Handler: compress(m),
}
log.Infof("Web server is listening on IP %s port %d.", ip, port)