http

package
v2.1.63 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RangePrefix is prefix of range header.
	RangePrefix = "bytes="

	// RangeSeparator is separator of range header.
	RangeSeparator = "-"
)
View Source
const (
	// DefaultDialTimeout is the default timeout for dialing a http connection.
	DefaultDialTimeout = 30 * time.Second
)

Variables

View Source
var COSFilteredQueryParams = []string{
	"q-sign-algorithm",
	"q-ak",
	"q-sign-time",
	"q-key-time",
	"q-header-list",
	"q-url-param-list",
	"q-signature",
	"x-cos-security-token",
}

COSFilteredQueryParams is the default filtered query params with cos protocol to generate the task id.

View Source
var ContainerdQueryParams = []string{
	"ns",
}

ContainerdQueryParams is the default filtered query params with containerd to generate the task id.

DefaultFilteredQueryParams is the default filtered query params to generate the task id.

View Source
var ErrNoOverlap = errors.New("invalid range: failed to overlap")

ErrNoOverlap is returned by ParseRange if first-byte-pos of all of the byte-range-spec values is greater than the content size.

View Source
var GCSFilteredQueryParams = []string{
	"X-Goog-Algorithm",
	"X-Goog-Credential",
	"X-Goog-Date",
	"X-Goog-Expires",
	"X-Goog-SignedHeaders",
	"X-Goog-Signature",
}

GCSFilteredQueryParams is the default filtered query params with gcs protocol to generate the task id.

View Source
var OBSFilteredQueryParams = []string{
	"AccessKeyId",
	"Signature",
	"Expires",
	"X-Obs-Date",
	"X-Obs-Security-Token",
}

OBSFilteredQueryParams is the default filtered query params with obs protocol to generate the task id.

View Source
var OSSFilteredQueryParams = []string{
	"OSSAccessKeyId",
	"Expires",
	"Signature",
	"SecurityToken",
}

OSSFilteredQueryParams is the default filtered query params with oss protocol to generate the task id.

RawDefaultFilteredQueryParams is the raw default filtered query params to generate the task id.

View Source
var S3FilteredQueryParams = []string{
	"X-Amz-Algorithm",
	"X-Amz-Credential",
	"X-Amz-Date",
	"X-Amz-Expires",
	"X-Amz-SignedHeaders",
	"X-Amz-Signature",
	"X-Amz-Security-Token",
	"X-Amz-User-Agent",
}

S3FilteredQueryParams is the default filtered query params with s3 protocol to generate the task id.

Functions

func HeaderToMap

func HeaderToMap(header http.Header) map[string]string

HeaderToMap coverts request headers to map[string]string.

func MapToHeader

func MapToHeader(m map[string]string) http.Header

MapToHeader coverts map[string]string to request headers.

func NewSafeDialer added in v2.0.30

func NewSafeDialer() *net.Dialer

NewSafeDialer returns a new net.Dialer with safe socket control.

func PickHeader

func PickHeader(header http.Header, key, defaultValue string) string

PickHeader pick header with key.

Types

type Range

type Range struct {
	Start, Length int64
}

Range specifies the byte range to be sent to the client.

func MustParseRange added in v2.0.9

func MustParseRange(s string, size int64) Range

MustParseRange is like ParseRange but panics if the range cannot be parsed.

func ParseOneRange added in v2.0.9

func ParseOneRange(s string, size int64) (Range, error)

ParseOneRange parses only one range of Range header string as per RFC 7233.

func ParseRange

func ParseRange(s string, size int64) ([]Range, error)

ParseRange parses a Range header string as per RFC 7233. ErrNoOverlap is returned if none of the ranges overlap. Example:

"Range": "bytes=100-200"
"Range": "bytes=-50"
"Range": "bytes=150-"
"Range": "bytes=0-0,-1"

copy from go/1.15.2 net/http/fs.go ParseRange

func ParseURLMetaRange added in v2.0.9

func ParseURLMetaRange(s string, size int64) (Range, error)

ParseRange parses a Range string of grpc UrlMeta. Example:

"Range": "100-200"
"Range": "-50"
"Range": "150-"

func (*Range) String

func (r *Range) String() string

String specifies the string of http header.

func (*Range) URLMetaString added in v2.0.9

func (r *Range) URLMetaString() string

String specifies the string of url meta.

Jump to

Keyboard shortcuts

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