package httputil

Import Path
	net/http/httputil (on golang.org and go.dev)

Dependency Relation
	imports 17 packages, and imported by 0 packages

Involved Source Files
	    dump.go
	d-> httputil.go
	    persist.go
	    reverseproxy.go

Exported Type Names

type BufferPool (interface) A BufferPool is an interface for getting and returning temporary byte slices for use by io.CopyBuffer. (T) Get() []byte (T) Put([]byte)
type ClientConn (struct) ClientConn is an artifact of Go's early HTTP implementation. It is low-level, old, and unused by Go's current HTTP stack. We should have deleted it before Go 1. Deprecated: Use Client or Transport in package net/http instead. (*T) Close() error (*T) Do(req *http.Request) (*http.Response, error) (*T) Hijack() (c net.Conn, r *bufio.Reader) (*T) Pending() int (*T) Read(req *http.Request) (resp *http.Response, err error) (*T) Write(req *http.Request) error *T : io.Closer func NewClientConn(c net.Conn, r *bufio.Reader) *ClientConn func NewProxyClientConn(c net.Conn, r *bufio.Reader) *ClientConn
type ReverseProxy (struct) ReverseProxy is an HTTP Handler that takes an incoming request and sends it to another server, proxying the response back to the client. ReverseProxy by default sets the client IP as the value of the X-Forwarded-For header. If an X-Forwarded-For header already exists, the client IP is appended to the existing values. As a special case, if the header exists in the Request.Header map but has a nil value (such as when set by the Director func), the X-Forwarded-For header is not modified. To prevent IP spoofing, be sure to delete any pre-existing X-Forwarded-For header coming from the client or an untrusted proxy. BufferPool BufferPool Director func(*http.Request) ErrorHandler func(http.ResponseWriter, *http.Request, error) ErrorLog *log.Logger FlushInterval time.Duration ModifyResponse func(*http.Response) error Transport http.RoundTripper (*T) ServeHTTP(rw http.ResponseWriter, req *http.Request) *T : net/http.Handler func NewSingleHostReverseProxy(target *url.URL) *ReverseProxy
type ServerConn (struct) ServerConn is an artifact of Go's early HTTP implementation. It is low-level, old, and unused by Go's current HTTP stack. We should have deleted it before Go 1. Deprecated: Use the Server in package net/http instead. (*T) Close() error (*T) Hijack() (net.Conn, *bufio.Reader) (*T) Pending() int (*T) Read() (*http.Request, error) (*T) Write(req *http.Request, resp *http.Response) error *T : io.Closer func NewServerConn(c net.Conn, r *bufio.Reader) *ServerConn
Exported Values
func DumpRequest(req *http.Request, body bool) ([]byte, error) DumpRequest returns the given request in its HTTP/1.x wire representation. It should only be used by servers to debug client requests. The returned representation is an approximation only; some details of the initial request are lost while parsing it into an http.Request. In particular, the order and case of header field names are lost. The order of values in multi-valued headers is kept intact. HTTP/2 requests are dumped in HTTP/1.x form, not in their original binary representations. If body is true, DumpRequest also returns the body. To do so, it consumes req.Body and then replaces it with a new io.ReadCloser that yields the same bytes. If DumpRequest returns an error, the state of req is undefined. The documentation for http.Request.Write details which fields of req are included in the dump.
func DumpRequestOut(req *http.Request, body bool) ([]byte, error) DumpRequestOut is like DumpRequest but for outgoing client requests. It includes any headers that the standard http.Transport adds, such as User-Agent.
func DumpResponse(resp *http.Response, body bool) ([]byte, error) DumpResponse is like DumpRequest but dumps a response.
var ErrClosed *http.ProtocolError Deprecated: No longer used.
var ErrLineTooLong error ErrLineTooLong is returned when reading malformed chunked data with lines that are too long.
var ErrPersistEOF *http.ProtocolError Deprecated: No longer used.
var ErrPipeline *http.ProtocolError Deprecated: No longer used.
func NewChunkedReader(r io.Reader) io.Reader NewChunkedReader returns a new chunkedReader that translates the data read from r out of HTTP "chunked" format before returning it. The chunkedReader returns io.EOF when the final 0-length chunk is read. NewChunkedReader is not needed by normal applications. The http package automatically decodes chunking when reading response bodies.
func NewChunkedWriter(w io.Writer) io.WriteCloser NewChunkedWriter returns a new chunkedWriter that translates writes into HTTP "chunked" format before writing them to w. Closing the returned chunkedWriter sends the final 0-length chunk that marks the end of the stream but does not send the final CRLF that appears after trailers; trailers and the last CRLF must be written separately. NewChunkedWriter is not needed by normal applications. The http package adds chunking automatically if handlers don't set a Content-Length header. Using NewChunkedWriter inside a handler would result in double chunking or chunking with a Content-Length length, both of which are wrong.
func NewClientConn(c net.Conn, r *bufio.Reader) *ClientConn NewClientConn is an artifact of Go's early HTTP implementation. It is low-level, old, and unused by Go's current HTTP stack. We should have deleted it before Go 1. Deprecated: Use the Client or Transport in package net/http instead.
func NewProxyClientConn(c net.Conn, r *bufio.Reader) *ClientConn NewProxyClientConn is an artifact of Go's early HTTP implementation. It is low-level, old, and unused by Go's current HTTP stack. We should have deleted it before Go 1. Deprecated: Use the Client or Transport in package net/http instead.
func NewServerConn(c net.Conn, r *bufio.Reader) *ServerConn NewServerConn is an artifact of Go's early HTTP implementation. It is low-level, old, and unused by Go's current HTTP stack. We should have deleted it before Go 1. Deprecated: Use the Server in package net/http instead.
func NewSingleHostReverseProxy(target *url.URL) *ReverseProxy NewSingleHostReverseProxy returns a new ReverseProxy that routes URLs to the scheme, host, and base path provided in target. If the target's path is "/base" and the incoming request was for "/dir", the target request will be for /base/dir. NewSingleHostReverseProxy does not rewrite the Host header. To rewrite Host headers, use ReverseProxy directly with a custom Director policy.