http_range

package
v0.0.0-...-d21987e Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: MIT, BSD-3-Clause Imports: 6 Imported by: 1

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, defaultChunkSize 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