common

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 License: Apache-2.0, Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package common provides shared utilities for HTTP transport implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsWeakETag

func IsWeakETag(etag string) bool

IsWeakETag reports whether the ETag is a weak validator (W/"...") which must not be used with If-Range per RFC 7232 §2.1.

func ParseContentRange

func ParseContentRange(h string) (int64, int64, int64, bool)

ParseContentRange parses "Content-Range: bytes start-end/total". It returns (start, end, total, ok). When total is unknown, total == -1.

func ParseSingleRange

func ParseSingleRange(h string) (int64, int64, bool)

ParseSingleRange parses a single "Range: bytes=start-end" header. It returns (start, end, ok). When end is omitted, end == -1.

Notes:

  • Only absolute-start forms are supported (no suffix ranges "-N").
  • Multi-range specifications (comma separated) return ok == false.

func ScrubConditionalHeaders

func ScrubConditionalHeaders(h http.Header)

ScrubConditionalHeaders removes conditional headers we do not want to forward on range requests, because they can alter semantics or conflict with If-Range logic.

func SupportsRange

func SupportsRange(h http.Header) bool

SupportsRange determines whether an HTTP response indicates support for range requests.

Types

This section is empty.

Jump to

Keyboard shortcuts

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