http

package
v0.0.0-...-b4abad3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LastModified       = "Last-Modified"
	Date               = "Date"
	ETag               = "ETag"
	ContentType        = "Content-Type"
	ContentMD5         = "Content-Md5"
	ContentEncoding    = "Content-Encoding"
	Expires            = "Expires"
	ContentLength      = "Content-Length"
	ContentLanguage    = "Content-Language"
	ContentRange       = "Content-Range"
	Connection         = "Connection"
	AcceptRanges       = "Accept-Ranges"
	AmzBucketRegion    = "X-Amz-Bucket-Region"
	ServerInfo         = "Server"
	RetryAfter         = "Retry-After"
	Location           = "Location"
	CacheControl       = "Cache-Control"
	ContentDisposition = "Content-Disposition"
	Authorization      = "Authorization"
	Action             = "Action"
)

Standard S3 HTTP response constants

View Source
const (
	IfModifiedSince   = "If-Modified-Since"
	IfUnmodifiedSince = "If-Unmodified-Since"
	IfMatch           = "If-Match"
	IfNoneMatch       = "If-None-Match"

	// S3 extensions
	AmzCopySourceIfModifiedSince   = "x-amz-copy-source-if-modified-since"
	AmzCopySourceIfUnmodifiedSince = "x-amz-copy-source-if-unmodified-since"

	AmzCopySourceIfNoneMatch = "x-amz-copy-source-if-none-match"
	AmzCopySourceIfMatch     = "x-amz-copy-source-if-match"

	AmzCopySource          = "X-Amz-Copy-Source"
	AmzCopySourceVersionID = "X-Amz-Copy-Source-Version-Id"
	AmzCopySourceRange     = "X-Amz-Copy-Source-Range"

	// Signature V4 related contants.
	AmzContentSha256        = "X-Amz-Content-Sha256"
	AmzDate                 = "X-Amz-Date"
	AmzAlgorithm            = "X-Amz-Algorithm"
	AmzExpires              = "X-Amz-Expires"
	AmzSignedHeaders        = "X-Amz-SignedHeaders"
	AmzSignature            = "X-Amz-Signature"
	AmzCredential           = "X-Amz-Credential"
	AmzSecurityToken        = "X-Amz-Security-Token"
	AmzDecodedContentLength = "X-Amz-Decoded-Content-Length"

	// Signature v2 related constants
	AmzSignatureV2 = "Signature"
	AmzAccessKeyID = "AWSAccessKeyId"

	// Response request id.
	AmzRequestID = "x-amz-request-id"

	// Deployment id.
	MinioDeploymentID = "x-minio-deployment-id"
)

Standard S3 HTTP request constants

View Source
const (

	// DefaultShutdownTimeout - default shutdown timeout used for graceful http server shutdown.
	DefaultShutdownTimeout = 5 * time.Second

	// DefaultTCPKeepAliveTimeout - default TCP keep alive timeout for accepted connection.
	DefaultTCPKeepAliveTimeout = 30 * time.Second

	// DefaultReadTimeout - default timout to read data from accepted connection.
	DefaultReadTimeout = 5 * time.Minute

	// DefaultWriteTimeout - default timout to write data to accepted connection.
	DefaultWriteTimeout = 5 * time.Minute

	// DefaultMaxHeaderBytes - default maximum HTTP header size in bytes.
	DefaultMaxHeaderBytes = 1 * humanize.MiByte
)

Variables

This section is empty.

Functions

func DrainBody

func DrainBody(respBody io.ReadCloser)

DrainBody close non nil response with any response Body. convenient wrapper to drain any remaining data on response body.

Subsequently this allows golang http RoundTripper to re-use the same connection for future requests.

Types

type DeadlineConn

type DeadlineConn struct {
	net.Conn
	// contains filtered or unexported fields
}

DeadlineConn - is a generic stream-oriented network connection supporting buffered reader and read/write timeout.

func (*DeadlineConn) Read

func (c *DeadlineConn) Read(b []byte) (n int, err error)

Read - reads data from the connection using wrapped buffered reader.

func (*DeadlineConn) Write

func (c *DeadlineConn) Write(b []byte) (n int, err error)

Write - writes data to the connection.

type Server

type Server struct {
	http.Server
	Addrs                  []string      // addresses on which the server listens for new connection.
	ReadTimeout            time.Duration // timeout used for net.Conn.Read() deadlines.
	WriteTimeout           time.Duration // timeout used for net.Conn.Write() deadlines.
	ShutdownTimeout        time.Duration // timeout used for graceful server shutdown.
	TCPKeepAliveTimeout    time.Duration // timeout used for underneath TCP connection.
	UpdateBytesReadFunc    func(int)     // function to be called to update bytes read in bufConn.
	UpdateBytesWrittenFunc func(int)     // function to be called to update bytes written in bufConn.
	// contains filtered or unexported fields
}

Server - extended http.Server supports multiple addresses to serve and enhanced connection handling.

func NewServer

func NewServer(addrs []string, handler http.Handler, getCert certs.GetCertificateFunc) *Server

NewServer - creates new HTTP server using given arguments.

func (*Server) GetRequestCount

func (srv *Server) GetRequestCount() int32

GetRequestCount - returns number of request in progress.

func (*Server) Shutdown

func (srv *Server) Shutdown() error

Shutdown - shuts down HTTP server.

func (*Server) Start

func (srv *Server) Start() (err error)

Start - start HTTP server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL