httphandlers

package module
v0.0.0-...-72d7525 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2016 License: BSD-3-Clause Imports: 16 Imported by: 0

README

A collection of HTTP Handlers for Go net/http

This package is deprecated in favor of resenje.org/httputils.

Installation

Run go get resenje.org/httphandlers from command line.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChainHandlers

func ChainHandlers(handlers ...func(http.Handler) http.Handler) (handler http.Handler)

func ContextHandler

func ContextHandler(h http.Handler) http.Handler

func HTTPToHTTPSRedirectHandler

func HTTPToHTTPSRedirectHandler(w http.ResponseWriter, r *http.Request)

func MaxBodyBytesHandler

func MaxBodyBytesHandler(h http.Handler, size int64, body string, contentType string) http.Handler

func MethodHandler

func MethodHandler(h map[string]http.Handler, body string, contentType string, w http.ResponseWriter, r *http.Request)

func NoCacheHeadersHandler

func NoCacheHeadersHandler(h http.Handler) http.Handler

func NoExpireHeadersHandler

func NoExpireHeadersHandler(h http.Handler) http.Handler

func SetHeadersHandler

func SetHeadersHandler(h http.Handler, headers *map[string]string) http.Handler

func StaticFilesHandler

func StaticFilesHandler(h http.Handler, prefix string, fs http.FileSystem) http.Handler

Types

type BasicAuthHandler

type BasicAuthHandler struct {
	Handler             http.Handler
	UnauthorizedHandler http.Handler
	ErrorHandler        func(w http.ResponseWriter, r *http.Request, err error)
	ValidateFunc        func(r *http.Request, username, password string) (rr *http.Request, valid bool, err error)
	AuthorizeAll        bool
	AuthorizedNetworks  []net.IPNet
	BasicAuthRealm      string
	Logger              *log.Logger
}

func (BasicAuthHandler) ServeHTTP

func (h BasicAuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ContextResponseWriter

type ContextResponseWriter struct {
	http.ResponseWriter
	context.Context
}

func (*ContextResponseWriter) CloseNotify

func (r *ContextResponseWriter) CloseNotify() <-chan bool

func (*ContextResponseWriter) Flush

func (r *ContextResponseWriter) Flush()

func (*ContextResponseWriter) Header

func (r *ContextResponseWriter) Header() http.Header

type DebugIndexHandler

type DebugIndexHandler struct {
	Path string
}

DebugIndexHandler serves pprof profiles under a defined Path. Path must end with the slash "/".

func (DebugIndexHandler) ServeHTTP

func (h DebugIndexHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves http request.

type IPAccessHandler

type IPAccessHandler struct {
	Handler             http.Handler
	UnauthorizedHandler http.Handler
	CIDRs               *[]string
	DenyAccess          bool
}

func (IPAccessHandler) ServeHTTP

func (h IPAccessHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type KeyAuth

type KeyAuth struct {
	Handler             http.Handler
	UnauthorizedHandler http.Handler
	Keys                map[string]bool
	ValidateFunc        func(key string) bool
	PostAuthFunc        func(key string, valid bool, w http.ResponseWriter, r *http.Request) bool
	AuthorizeAll        bool
	AuthorizedNetworks  []net.IPNet
	HeaderName          string
	BasicAuthRealm      string
}

func (KeyAuth) ServeHTTP

func (h KeyAuth) ServeHTTP(w http.ResponseWriter, r *http.Request)

type TCPKeepAliveListener

type TCPKeepAliveListener struct {
	*net.TCPListener
}

func (TCPKeepAliveListener) Accept

func (ln TCPKeepAliveListener) Accept() (c net.Conn, err error)

type TLSListener

type TLSListener struct {
	*net.TCPListener
	TLSConfig *tls.Config
}

func (TLSListener) Accept

func (l TLSListener) Accept() (net.Conn, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL