vault: github.com/hashicorp/vault/vendor/github.com/hashicorp/go-cleanhttp Index | Files

package cleanhttp

import "github.com/hashicorp/vault/vendor/github.com/hashicorp/go-cleanhttp"

Package cleanhttp offers convenience utilities for acquiring "clean" http.Transport and http.Client structs.

Values set on http.DefaultClient and http.DefaultTransport affect all callers. This can have detrimental effects, esepcially in TLS contexts, where client or root certificates set to talk to multiple endpoints can end up displacing each other, leading to hard-to-debug issues. This package provides non-shared http.Client and http.Transport structs to ensure that the configuration will not be overwritten by other parts of the application or dependencies.

The DefaultClient and DefaultTransport functions disable idle connections and keepalives. Without ensuring that idle connections are closed before garbage collection, short-term clients/transports can leak file descriptors, eventually leading to "too many open files" errors. If you will be connecting to the same hosts repeatedly from the same client, you can use DefaultPooledClient to receive a client that has connection pooling semantics similar to http.DefaultClient.

Index

Package Files

cleanhttp.go doc.go handlers.go

func DefaultClient Uses

func DefaultClient() *http.Client

DefaultClient returns a new http.Client with similar default values to http.Client, but with a non-shared Transport, idle connections disabled, and keepalives disabled.

func DefaultPooledClient Uses

func DefaultPooledClient() *http.Client

DefaultPooledClient returns a new http.Client with similar default values to http.Client, but with a shared Transport. Do not use this function for transient clients as it can leak file descriptors over time. Only use this for clients that will be re-used for the same host(s).

func DefaultPooledTransport Uses

func DefaultPooledTransport() *http.Transport

DefaultPooledTransport returns a new http.Transport with similar default values to http.DefaultTransport. Do not use this for transient transports as it can leak file descriptors over time. Only use this for transports that will be re-used for the same host(s).

func DefaultTransport Uses

func DefaultTransport() *http.Transport

DefaultTransport returns a new http.Transport with similar default values to http.DefaultTransport, but with idle connections and keepalives disabled.

func PrintablePathCheckHandler Uses

func PrintablePathCheckHandler(next http.Handler, input *HandlerInput) http.Handler

PrintablePathCheckHandler is a middleware that ensures the request path contains only printable runes.

type HandlerInput Uses

type HandlerInput struct {
    ErrStatus int
}

HandlerInput provides input options to cleanhttp's handlers

Package cleanhttp imports 6 packages (graph). Updated 2019-04-23. Refresh now. Tools for package owners.