Documentation ¶
Index ¶
- Constants
- Variables
- func Dial(addr string) (net.Conn, error)
- func DialDualStack(addr string) (net.Conn, error)
- func DialDualStackTimeout(addr string, timeout time.Duration) (net.Conn, error)
- func DialTimeout(addr string, timeout time.Duration) (net.Conn, error)
- type DialFunc
- type Header
- type PipeConns
- type PipelineClient
- type Request
- type Resolver
- type Response
- func (r *Response) CloseRequested() bool
- func (r *Response) ContentLength() int64
- func (resp *Response) Read(r *bufio.Reader) error
- func (resp *Response) ReadBody(r *bufio.Reader) io.Reader
- func (resp *Response) ReadHeader(r *bufio.Reader) (string, string, bool, error)
- func (resp *Response) ReadStatusCode(r *bufio.Reader) (int, error)
- func (resp *Response) ReadStatusLine(r *bufio.Reader) (Version, int, string, error)
- func (resp *Response) ReadVersion(r *bufio.Reader) (Version, error)
- func (r *Response) TransferEncoding() string
- type RetryIfFunc
- type Status
- type TCPDialer
- func (d *TCPDialer) Dial(addr string) (net.Conn, error)
- func (d *TCPDialer) DialDualStack(addr string) (net.Conn, error)
- func (d *TCPDialer) DialDualStackTimeout(addr string, timeout time.Duration) (net.Conn, error)
- func (d *TCPDialer) DialTimeout(addr string, timeout time.Duration) (net.Conn, error)
- type Version
Constants ¶
const DefaultDNSCacheDuration = time.Minute
DefaultDNSCacheDuration is the duration for caching resolved TCP addresses by Dial* functions.
const DefaultDialTimeout = 3 * time.Second
DefaultDialTimeout is timeout used by Dial and DialDualStack for establishing TCP connections.
const DefaultMaxConnsPerHost = 512
const DefaultMaxIdemponentCallAttempts = 5
const DefaultMaxIdleConnDuration = 10 * time.Second
const DefaultMaxPendingRequests = 1024
Variables ¶
var ( ErrNoFreeConns = errors.New("no free connections available to host") ErrConnectionClosed = errors.New("the server closed connection before returning the first response byte. " + "Make sure the server returns 'Connection: close' response header before closing the connection") // ErrGetOnly is returned when server expects only GET requests, // but some other type of request came (Server.GetOnly option is true). ErrGetOnly = errors.New("non-GET request received") )
var ( HTTP_1_0 = Version{Major: 1, Minor: 0} HTTP_1_1 = Version{Major: 1, Minor: 1} )
var ErrDialTimeout = errors.New("dialing to the given TCP address timed out")
ErrDialTimeout is returned when TCP dialing is timed out.
var ErrPipelineOverflow = errors.New("pipelined requests' queue has been overflown. Increase MaxConns and/or MaxPendingRequests")
var ErrTLSHandshakeTimeout = errors.New("tls handshake timed out")
ErrTLSHandshakeTimeout indicates there is a timeout from tls handshake.
var (
ErrTimeout = &timeoutError{}
)
Functions ¶
func DialDualStackTimeout ¶
Types ¶
type PipeConns ¶
type PipeConns struct {
// contains filtered or unexported fields
}
func NewPipeConns ¶
func NewPipeConns() *PipeConns
type PipelineClient ¶
type PipelineClient struct { Addr string MaxConns int MaxPendingRequests int MaxBatchDelay time.Duration Dial DialFunc DialDualStack bool IsTLS bool TLSConfig *tls.Config MaxIdleConnDuration time.Duration ReadBufferSize int WriteBufferSize int ReadTimeout time.Duration WriteTimeout time.Duration // contains filtered or unexported fields }
func (*PipelineClient) PendingRequests ¶
func (c *PipelineClient) PendingRequests() int
type Request ¶
type Request struct { AutomaticContentLength bool AutomaticHost bool Method string Path string Query []string Version Headers []Header Body io.Reader }
Request represents a complete HTTP request.
func (*Request) ContentLength ¶
ContentLength returns the length of the body. If the body length is not known ContentLength will return -1.
type Response ¶
type Response struct { Version Status Headers []Header Body io.Reader // contains filtered or unexported fields }
Response represents an RFC2616 response.
func (*Response) CloseRequested ¶
CloseRequested returns if Reason includes a Connection: close header.
func (*Response) ContentLength ¶
ContentLength returns the length of the body. If the body length is not known ContentLength will return -1.
func (*Response) ReadHeader ¶
ReadHeader reads a http header.
func (*Response) ReadStatusCode ¶
ReadStatusCode reads the HTTP status code from the wire.
func (*Response) ReadStatusLine ¶
ReadStatusLine reads the status line.
func (*Response) TransferEncoding ¶
TransferEncoding returns the transfer encoding this message was transmitted with. If not is specified by the sender, "identity" is assumed.