Namespace: go.std.net.http.httputil
v1.0Contents
Summary
Provides a low-level interface to the net/http/httputil package.
Package httputil provides HTTP utility functions, complementing the
more common ones in the net/http package.
Index
- *ClientConn
- *ReverseProxy
- *ServerConn
- BufferPool
- ClientConn
- DumpRequest
- DumpRequestOut
- DumpResponse
- ErrClosed
- ErrLineTooLong
- ErrPersistEOF
- ErrPipeline
- NewChunkedReader
- NewChunkedWriter
- NewClientConn
- NewProxyClientConn
- NewServerConn
- NewSingleHostReverseProxy
- ReverseProxy
- ServerConn
- arrayOfBufferPool
- arrayOfClientConn
- arrayOfReverseProxy
- arrayOfServerConn
Legend
-
Constant
Variable
Function
Macro
Special form
Type
GoVar
Receiver/Method
Constants
Constants are variables with :const true in their metadata. Joker currently does not recognize them as special; as such, it allows redefining them or their values.-
(None.)
Variables
-
ErrClosed
Var v1.0Deprecated: No longer used.
-
ErrLineTooLong
Var v1.0ErrLineTooLong is returned when reading malformed chunked data
with lines that are too long.
-
ErrPersistEOF
Var v1.0Deprecated: No longer used.
-
ErrPipeline
Var v1.0Deprecated: No longer used.
Functions, Macros, and Special Forms
-
DumpRequest
Function v1.0(DumpRequest req body)
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.
Go input arguments: (req *net/http.Request, body bool)
Go returns: ([]byte, error)
Joker input arguments: [^go.std.net.http/*Request req, ^Boolean body]
Joker returns: [^arrayOfByte, ^Error] -
DumpRequestOut
Function v1.0(DumpRequestOut req body)
DumpRequestOut is like DumpRequest but for outgoing client requests. It
includes any headers that the standard http.Transport adds, such as
User-Agent.
Go input arguments: (req *net/http.Request, body bool)
Go returns: ([]byte, error)
Joker input arguments: [^go.std.net.http/*Request req, ^Boolean body]
Joker returns: [^arrayOfByte, ^Error] -
DumpResponse
Function v1.0(DumpResponse resp body)
DumpResponse is like DumpRequest but dumps a response.
Go input arguments: (resp *net/http.Response, body bool)
Go returns: ([]byte, error)
Joker input arguments: [^go.std.net.http/*Response resp, ^Boolean body]
Joker returns: [^arrayOfByte, ^Error] -
NewChunkedReader
Function v1.0(NewChunkedReader r)
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.
Go input arguments: (r io.Reader)
Go returns: io.Reader
Joker input arguments: [^go.std.io/Reader r]
Joker returns: ^go.std.io/Reader -
NewChunkedWriter
Function v1.0(NewChunkedWriter w)
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.
Go input arguments: (w io.Writer)
Go returns: io.WriteCloser
Joker input arguments: [^go.std.io/Writer w]
Joker returns: ^go.std.io/WriteCloser -
NewClientConn
Function v1.0(NewClientConn c r)
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.
Go input arguments: (c net.Conn, r *bufio.Reader)
Go returns: *ClientConn
Joker input arguments: [^go.std.net/Conn c, ^go.std.bufio/*Reader r]
Joker returns: ^*ClientConn -
NewProxyClientConn
Function v1.0(NewProxyClientConn c r)
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.
Go input arguments: (c net.Conn, r *bufio.Reader)
Go returns: *ClientConn
Joker input arguments: [^go.std.net/Conn c, ^go.std.bufio/*Reader r]
Joker returns: ^*ClientConn -
NewServerConn
Function v1.0(NewServerConn c r)
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.
Go input arguments: (c net.Conn, r *bufio.Reader)
Go returns: *ServerConn
Joker input arguments: [^go.std.net/Conn c, ^go.std.bufio/*Reader r]
Joker returns: ^*ServerConn -
NewSingleHostReverseProxy
Function v1.0(NewSingleHostReverseProxy target)
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.
Go input arguments: (target *net/url.URL)
Go returns: *ReverseProxy
Joker input arguments: [^go.std.net.url/*URL target]
Joker returns: ^*ReverseProxy
Types
-
*ClientConn
Concrete Type v1.0ClientConn 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.
-
Close
Receiver for *ClientConn v1.0([])
Close calls Hijack and then also closes the underlying connection.
-
Do
Receiver for *ClientConn v1.0([req])
Do is convenience method that writes a request and reads a response.
-
Hijack
Receiver for *ClientConn v1.0([])
Hijack detaches the ClientConn and returns the underlying connection as well
as the read-side bufio which may have some left over data. Hijack may be
called before the user or Read have signaled the end of the keep-alive
logic. The user should not call Hijack while Read or Write is in progress.
-
Pending
Receiver for *ClientConn v1.0([])
Pending returns the number of unanswered requests
that have been sent on the connection.
-
Read
Receiver for *ClientConn v1.0([req])
Read reads the next response from the wire. A valid response might be
returned together with an ErrPersistEOF, which means that the remote
requested that this be the last request serviced. Read can be called
concurrently with Write, but not with another Read.
-
Write
Receiver for *ClientConn v1.0([req])
Write writes a request. An ErrPersistEOF error is returned if the connection
has been closed in an HTTP keep-alive sense. If req.Close equals true, the
keep-alive connection is logically closed after this request and the opposing
server is informed. An ErrUnexpectedEOF indicates the remote closed the
underlying TCP connection, which is usually considered as graceful close.
-
*ReverseProxy
Concrete Type v1.0ReverseProxy 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.
-
ServeHTTP
Receiver for *ReverseProxy v1.0([rw req])
-
*ServerConn
Concrete Type v1.0ServerConn 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.
-
Close
Receiver for *ServerConn v1.0([])
Close calls Hijack and then also closes the underlying connection.
-
Hijack
Receiver for *ServerConn v1.0([])
Hijack detaches the ServerConn and returns the underlying connection as well
as the read-side bufio which may have some left over data. Hijack may be
called before Read has signaled the end of the keep-alive logic. The user
should not call Hijack while Read or Write is in progress.
-
Pending
Receiver for *ServerConn v1.0([])
Pending returns the number of unanswered requests
that have been received on the connection.
-
Read
Receiver for *ServerConn v1.0([])
Read returns the next request on the wire. An ErrPersistEOF is returned if
it is gracefully determined that there are no more requests (e.g. after the
first request on an HTTP/1.0 connection, or after a Connection:close on a
HTTP/1.1 connection).
-
Write
Receiver for *ServerConn v1.0([req resp])
Write writes resp in response to req. To close the connection gracefully, set the
Response.Close field to true. Write should be considered operational until
it returns an error, regardless of any errors returned on the Read side.
-
BufferPool
Abstract Type v1.0A BufferPool is an interface for getting and returning temporary
byte slices for use by io.CopyBuffer.
-
Get
Method for BufferPool v1.0([])
-
Put
Method for BufferPool v1.0([arg1])
-
ClientConn
Concrete Type v1.0ClientConn 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.
-
ReverseProxy
Concrete Type v1.0ReverseProxy 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.
-
ServerConn
Concrete Type v1.0ServerConn 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.
-
arrayOfBufferPool
Concrete Type v1.0A BufferPool is an interface for getting and returning temporary
byte slices for use by io.CopyBuffer.
-
arrayOfClientConn
Concrete Type v1.0ClientConn 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.
-
arrayOfReverseProxy
Concrete Type v1.0ReverseProxy 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.
-
arrayOfServerConn
Concrete Type v1.0ServerConn 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.