httprange

package
v0.0.0-...-8da89e4 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2022 License: MIT, BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package http_range implements http range parsing.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoOverlap is returned by ParseRange if first-byte-pos of
	// all of the byte-range-spec values is greater than the content size.
	ErrNoOverlap = errors.New("invalid range: failed to overlap")

	// ErrInvalid is returned by ParseRange on invalid input.
	ErrInvalid = errors.New("invalid range")
)

Functions

This section is empty.

Types

type Range

type Range struct {
	Start  int64
	Length int64
}

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

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. ErrInvalid is returned if s is invalid range.

func (Range) ContentRange

func (r Range) ContentRange(size int64) string

ContentRange returns Content-Range header value.

Jump to

Keyboard shortcuts

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