httptoo

package
v0.0.0-...-65b0b50 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2017 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Default = 0
	Public  = 1
	Private = 2
)

Variables

This section is empty.

Functions

func ClientTLSConfig

func ClientTLSConfig(cl *http.Client) *tls.Config

Returns the http.Client's TLS Config, traversing and generating any defaults along the way to get it.

func CopyURL

func CopyURL(u *url.URL) (ret *url.URL)

Deep copies a URL.

func EncodeQuotedString

func EncodeQuotedString(s string) string

Performs quoted-string from http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html

func ForwardResponse

func ForwardResponse(w http.ResponseWriter, r *http.Response)

func GzipHandler

func GzipHandler(h http.Handler) http.Handler

Gzips response body if the request says it'll allow it.

func NukeCookie

func NukeCookie(w http.ResponseWriter, r *http.Request, name, path string)

Clears the named cookie for every domain that leads to the current one.

func OriginatingProtocol

func OriginatingProtocol(r *http.Request) string

func RedirectedRequest

func RedirectedRequest(r *http.Request, newUrl string) (ret *http.Request, err error)

Takes a request, and alters its destination fields, for proxying.

func RequestCloseNotifyValue

func RequestCloseNotifyValue(r *http.Request) <-chan struct{}

func RequestIsForLocalhost

func RequestIsForLocalhost(r *http.Request) bool

Request is intended for localhost, either with a localhost name, or loopback IP.

func RequestIsFromLocalhost

func RequestIsFromLocalhost(r *http.Request) bool

Request originated from a loopback IP.

func RequestWithCloseNotify

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

func RequestedURL

func RequestedURL(r *http.Request) (ret *url.URL)

Reconstructs the URL that would have produced the given Request. Request.URLs are not fully populated in http.Server handlers.

func ReverseProxy

func ReverseProxy(w http.ResponseWriter, r *http.Request, originUrl string, client *http.Client) (err error)

func ReverseProxyUpgrade

func ReverseProxyUpgrade(w http.ResponseWriter, r *http.Request, originUrl string) (err error)

w is for the client response. r is the request to send to the origin (already "forwarded"). originUrl is where to send the request.

func RoundTripHandler

func RoundTripHandler(req *http.Request, h http.Handler) (*http.Response, error)

func SetOriginRequestForwardingHeaders

func SetOriginRequestForwardingHeaders(o, f *http.Request)

func WrapHandler

func WrapHandler(middleware []Middleware, h http.Handler) (ret http.Handler)

func WrapHandlerFunc

func WrapHandlerFunc(middleware []Middleware, hf func(http.ResponseWriter, *http.Request)) (ret http.Handler)

Types

type BytesContentRange

type BytesContentRange struct {
	First, Last, Length int64
}

func ParseBytesContentRange

func ParseBytesContentRange(s string) (ret BytesContentRange, ok bool)

type BytesRange

type BytesRange struct {
	First, Last int64
}

func ParseBytesRange

func ParseBytesRange(s string) (ret BytesRange, ok bool)

type CacheControlHeader

type CacheControlHeader struct {
	MaxAge  time.Duration
	Caching Visibility
	NoStore bool
}

func (CacheControlHeader) String

func (me CacheControlHeader) String() string

type InProcRoundTripper

type InProcRoundTripper struct {
	Handler http.Handler
}

func (*InProcRoundTripper) RoundTrip

func (me *InProcRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

type Middleware

type Middleware func(http.Handler) http.Handler

type Visibility

type Visibility int

Jump to

Keyboard shortcuts

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