package
0.0.0-20220111133703-f1e56083d4f3
Repository: https://github.com/sandwichdev/net.git
Documentation: pkg.go.dev

# Packages

Package cgi implements CGI (Common Gateway Interface) as specified in RFC 3875.
Package cookiejar implements an in-memory RFC 6265-compliant http.CookieJar.
Package fcgi implements the FastCGI protocol.
Package httpguts provides functions implementing various details of the HTTP specification.
Package httpproxy provides support for HTTP proxy determination based on environment variables, as provided by net/http's ProxyFromEnvironment function.
Package httptest provides utilities for HTTP testing.
Package httptrace provides mechanisms to trace the events within HTTP client requests.
Package httputil provides HTTP utility functions, complementing the more common ones in the net/http package.
Package pprof serves via its HTTP server runtime profiling data in the format expected by the pprof visualization tool.

# Functions

CanonicalHeaderKey returns the canonical format of the header key s.
DecompressBody is used to return the proper decoded body based on the content encoding (gzip, brotli, deflate).
DetectContentType implements the algorithm described at https://mimesniff.spec.whatwg.org/ to determine the Content-Type of the given data.
Error replies to the request with the specified error message and HTTP code.
FileServer returns a handler that serves HTTP requests with the contents of the file system rooted at root.
FS converts fsys to a FileSystem implementation, for use with FileServer and NewFileTransport.
Get issues a GET to the specified URL.
Handle registers the handler for the given pattern in the DefaultServeMux.
HandleFunc registers the handler function for the given pattern in the DefaultServeMux.
Head issues a HEAD to the specified URL.
ListenAndServe listens on the TCP network address addr and then calls Serve with handler to handle requests on incoming connections.
ListenAndServeTLS acts identically to ListenAndServe, except that it expects HTTPS connections.
MaxBytesReader is similar to io.LimitReader but is intended for limiting the size of incoming request bodies.
NewFileTransport returns a new RoundTripper, serving the provided FileSystem.
NewRequest wraps NewRequestWithContext using the background context.
NewRequestWithContext returns a new Request given a method, URL, and optional body.
NewServeMux allocates and returns a new ServeMux.
NotFound replies to the request with an HTTP 404 not found error.
NotFoundHandler returns a simple request handler that replies to each request with a ``404 page not found'' reply.
ParseHTTPVersion parses an HTTP version string.
ParseTime parses a time header (such as the Date: header), trying each of the three formats allowed by HTTP/1.1: TimeFormat, time.RFC850, and time.ANSIC.
Post
Post issues a POST to the specified URL.
PostForm issues a POST to the specified URL, with data's keys and values URL-encoded as the request body.
ProxyFromEnvironment returns the URL of the proxy to use for a given request, as indicated by the environment variables HTTP_PROXY, HTTPS_PROXY and NO_PROXY (or the lowercase versions thereof).
ProxyURL returns a proxy function (for use in a Transport) that always returns the same URL.
ReadRequest reads and parses an incoming request from b.
ReadResponse reads and returns an HTTP response from r.
Redirect replies to the request with a redirect to url, which may be a path relative to the request path.
RedirectHandler returns a request handler that redirects each request it receives to the given url using the given status code.
Serve accepts incoming HTTP connections on the listener l, creating a new service goroutine for each.
ServeContent replies to the request using the content in the provided ReadSeeker.
ServeFile replies to the request with the contents of the named file or directory.
ServeTLS accepts incoming HTTPS connections on the listener l, creating a new service goroutine for each.
SetCookie adds a Set-Cookie header to the provided ResponseWriter's headers.
StatusText returns a text for the HTTP status code.
StripPrefix returns a handler that serves HTTP requests by removing the given prefix from the request URL's Path (and RawPath if set) and invoking the handler h.
TimeoutHandler returns a Handler that runs h with the given time limit.

# Constants

1 MB.
DefaultMaxIdleConnsPerHost is the default value of Transport's MaxIdleConnsPerHost.
Common HTTP methods.
Common HTTP methods.
Common HTTP methods.
Common HTTP methods.
Common HTTP methods.
RFC 5789.
Common HTTP methods.
Common HTTP methods.
Common HTTP methods.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
StateActive represents a connection that has read 1 or more bytes of a request.
StateClosed represents a closed connection.
StateHijacked represents a hijacked connection.
StateIdle represents a connection that has finished handling a request and is in the keep-alive state, waiting for a new request.
StateNew represents a new connection that is expected to send a request immediately.
RFC 7231, 6.3.3.
RFC 5842, 7.1.
RFC 7231, 6.6.3.
RFC 7231, 6.5.1.
RFC 7231, 6.5.8.
RFC 7231, 6.2.1.
RFC 7231, 6.3.2.
RFC 8297.
RFC 7231, 6.5.14.
RFC 4918, 11.4.
RFC 7231, 6.5.3.
RFC 7231, 6.4.3.
RFC 7231, 6.6.5.
RFC 7231, 6.5.9.
RFC 7231, 6.6.6.
RFC 3229, 10.4.1.
RFC 4918, 11.5.
RFC 7231, 6.6.1.
RFC 7231, 6.5.10.
RFC 4918, 11.3.
RFC 5842, 7.2.
RFC 7231, 6.5.5.
RFC 7540, 9.1.2.
RFC 7231, 6.4.2.
RFC 7231, 6.4.1.
RFC 4918, 11.1.
RFC 6585, 6.
RFC 7231, 6.3.5.
RFC 7231, 6.3.4.
RFC 7231, 6.5.6.
RFC 2774, 7.
RFC 7231, 6.5.4.
RFC 7231, 6.6.2.
RFC 7232, 4.1.
RFC 7231, 6.3.1.
RFC 7233, 4.1.
RFC 7231, 6.5.2.
RFC 7538, 3.
RFC 7232, 4.2.
RFC 6585, 3.
RFC 2518, 10.1.
RFC 7235, 3.2.
RFC 7233, 4.4.
RFC 7231, 6.5.11.
RFC 6585, 5.
RFC 7231, 6.5.7.
RFC 7231, 6.5.12.
RFC 7231, 6.3.6.
RFC 7231, 6.4.4.
RFC 7231, 6.6.4.
RFC 7231, 6.2.2.
RFC 7168, 2.3.3.
RFC 7231, 6.4.7.
RFC 8470, 5.2.
RFC 6585, 4.
RFC 7235, 3.1.
RFC 7725, 3.
RFC 4918, 11.2.
RFC 7231, 6.5.13.
RFC 7231, 6.5.15.
RFC 7231, 6.4.5.
RFC 2295, 8.1.
TimeFormat is the time format to use when generating times in HTTP headers.
TrailerPrefix is a magic prefix for ResponseWriter.Header map keys that, if present, signals that the map entry is actually for the response trailers, and not the response headers.

# Variables

DefaultClient is the default Client and is used by Get, Head, and Post.
DefaultServeMux is the default ServeMux used by Serve.
DefaultTransport is the default implementation of Transport and is used by DefaultClient.
ErrAbortHandler is a sentinel panic value to abort a handler.
ErrBodyNotAllowed is returned by ResponseWriter.Write calls when the HTTP method or response code does not permit a body.
ErrBodyReadAfterClose is returned when reading a Request or Response Body after the body has been closed.
ErrContentLength is returned by ResponseWriter.Write calls when a Handler set a Content-Length response header with a declared size and then attempted to write more bytes than declared.
ErrHandlerTimeout is returned on ResponseWriter Write calls in handlers which have timed out.
Deprecated: ErrHeaderTooLong is no longer returned by anything in the net/http package.
ErrHijacked is returned by ResponseWriter.Write calls when the underlying connection has been hijacked using the Hijacker interface.
ErrLineTooLong is returned when reading request or response bodies with malformed chunked encoding.
ErrMissingBoundary is returned by Request.MultipartReader when the request's Content-Type does not include a "boundary" parameter.
Deprecated: ErrMissingContentLength is no longer returned by anything in the net/http package.
ErrMissingFile is returned by FormFile when the provided file field name is either not present in the request or not a file field.
ErrNoCookie is returned by Request's Cookie method when a cookie is not found.
ErrNoLocation is returned by Response's Location method when no Location header is present.
ErrNotMultipart is returned by Request.MultipartReader when the request's Content-Type is not multipart/form-data.
ErrNotSupported is returned by the Push method of Pusher implementations to indicate that HTTP/2 Push support is not available.
ErrServerClosed is returned by the Server's Serve, ServeTLS, ListenAndServe, and ListenAndServeTLS methods after a call to Shutdown or Close.
Deprecated: ErrShortBody is no longer returned by anything in the net/http package.
ErrSkipAltProtocol is a sentinel error value defined by Transport.RegisterProtocol.
Deprecated: ErrUnexpectedTrailer is no longer returned by anything in the net/http package.
ErrUseLastResponse can be returned by Client.CheckRedirect hooks to control how redirects are processed.
Deprecated: ErrWriteAfterFlush is no longer returned by anything in the net/http package.
LocalAddrContextKey is a context key.
NoBody is an io.ReadCloser with no bytes.
ServerContextKey is a context key.

# Structs

A Client is an HTTP client.
A Cookie represents an HTTP cookie as sent in the Set-Cookie header of an HTTP response or the Cookie header of an HTTP request.
ProtocolError represents an HTTP protocol error.
PushOptions describes options for Pusher.Push.
A Request represents an HTTP request received by a server or to be sent by a client.
Response represents the response from an HTTP request.
ServeMux is an HTTP request multiplexer.
A Server defines parameters for running an HTTP server.
Transport is an implementation of RoundTripper that supports HTTP, HTTPS, and HTTP proxies (for either HTTP or HTTPS with CONNECT).

# Interfaces

The CloseNotifier interface is implemented by ResponseWriters which allow detecting when the underlying connection has gone away.
A CookieJar manages storage and use of cookies in HTTP requests.
A File is returned by a FileSystem's Open method and can be served by the FileServer implementation.
A FileSystem implements access to a collection of named files.
The Flusher interface is implemented by ResponseWriters that allow an HTTP handler to flush buffered data to the client.
A Handler responds to an HTTP request.
The Hijacker interface is implemented by ResponseWriters that allow an HTTP handler to take over the connection.
Pusher is the interface implemented by ResponseWriters that support HTTP/2 server push.
A ResponseWriter interface is used by an HTTP handler to construct an HTTP response.
RoundTripper is an interface representing the ability to execute a single HTTP transaction, obtaining the Response for a given Request.

# Type aliases

A ConnState represents the state of a client connection to a server.
A Dir implements FileSystem using the native file system restricted to a specific directory tree.
The HandlerFunc type is an adapter to allow the use of ordinary functions as HTTP handlers.
A Header represents the key-value pairs in an HTTP header.
SameSite allows a server to define a cookie attribute making it impossible for the browser to send this cookie along with cross-site requests.