gitea: code.gitea.io/gitea/modules/gzip Index | Files

package gzip

import "code.gitea.io/gitea/modules/gzip"

Index

Package Files

gzip.go

Constants

const (
    // MinSize is the minimum size of content we will compress
    MinSize = 1400
)

func Middleware Uses

func Middleware(options ...Options) macaron.Handler

Middleware creates a macaron.Handler to proxy the response

type Options Uses

type Options struct {
    CompressionLevel int
}

Options represents the configuration for the gzip middleware

type ProxyResponseWriter Uses

type ProxyResponseWriter struct {
    macaron.ResponseWriter
    // contains filtered or unexported fields
}

ProxyResponseWriter is a wrapped macaron ResponseWriter that may compress its contents

func (*ProxyResponseWriter) Close Uses

func (proxy *ProxyResponseWriter) Close() error

Close the writer

func (*ProxyResponseWriter) Flush Uses

func (proxy *ProxyResponseWriter) Flush()

Flush the writer

func (*ProxyResponseWriter) Hijack Uses

func (proxy *ProxyResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)

Hijack implements http.Hijacker. If the underlying ResponseWriter is a Hijacker, its Hijack method is returned. Otherwise an error is returned.

func (*ProxyResponseWriter) Write Uses

func (proxy *ProxyResponseWriter) Write(b []byte) (int, error)

Write appends data to the proxied gzip writer.

func (*ProxyResponseWriter) WriteHeader Uses

func (proxy *ProxyResponseWriter) WriteHeader(code int)

WriteHeader will ensure that we have setup the writer before we write the header

type WriterPool Uses

type WriterPool struct {
    // contains filtered or unexported fields
}

WriterPool is a gzip writer pool to reduce workload on creation of gzip writers

func NewWriterPool Uses

func NewWriterPool(compressionLevel int) *WriterPool

NewWriterPool creates a new pool

func (*WriterPool) Get Uses

func (wp *WriterPool) Get(rw macaron.ResponseWriter) *gzip.Writer

Get a writer from the pool - or create one if not available

func (*WriterPool) Put Uses

func (wp *WriterPool) Put(w *gzip.Writer)

Put returns a writer to the pool

Package gzip imports 11 packages (graph) and is imported by 2 packages. Updated 2019-07-15. Refresh now. Tools for package owners.