An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 5.3% on proxy.golang.org
Top 1.6% dependent packages on proxy.golang.org
Top 1.8% dependent repos on proxy.golang.org
Top 8.8% forks on proxy.golang.org

proxy.golang.org : github.com/xi2/httpgzip

Package httpgzip implements an http.Handler wrapper adding gzip compression for appropriate requests. It attempts to properly parse the request's Accept-Encoding header according to RFC 2616 and does not do a simple string search for "gzip" (which will fail to do the correct thing for values such as "*" or "identity,gzip;q=0"). It will serve either gzip or identity content codings (identity meaning no encoding), or return 406 Not Acceptable status if it can do neither. It works correctly with handlers which honour Range request headers (such as http.FileServer) by removing the Range header for requests which prefer gzip encoding. This is necessary since Range requests apply to the gzipped content but the wrapped handler is not aware of the compression when it writes byte ranges. The Accept-Ranges header is also stripped from corresponding responses. For requests which prefer gzip encoding a Content-Type header is set using http.DetectContentType if it is not set by the wrapped handler. By default, httpgzip uses the standard library gzip implementation. To use the optimized gzip implementation from https://github.com/klauspost/compress instead, download and install httpgzip with the "kpgzip" build tag: or simply alter the import line in httpgzip.go. Thanks are due to Klaus Post for his blog post which inspired the creation of this package and is recommended reading:     https://blog.klauspost.com/gzip-performance-for-go-webservers/

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/xi2/httpgzip
License: MIT
Latest release: about 6 years ago
First release: about 6 years ago
Namespace: github.com/xi2
Dependent packages: 11
Dependent repositories: 8
Stars: 13 on GitHub
Forks: 4 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: about 1 month ago

    Loading...
    Readme
    Loading...