Movatterモバイル変換


[0]ホーム

URL:


httphdr

package
v1.92.3Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License:BSD-3-ClauseImports:3Imported by:2

Details

Repository

github.com/tailscale/tailscale

Links

Documentation

Overview

Package httphdr implements functionality for parsing and formattingstandard HTTP headers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcFormatContentRange

func FormatContentRange(start, length, completeLengthint64) (hdrstring, okbool)

FormatContentRange parses a "Content-Range" header perRFC 7233, section 4.2.It only handles "Content-Range" headers where the units is "bytes".The "Content-Range" header is usually only specified in HTTP responses.

If start and length are non-positive, then it encodes just the completeLength,which must be a non-negative value.

Otherwise, it encodes the start and length as a byte-range,and optionally emits the complete length if it is non-negative.The length must be positive (asRFC 7233 uses inclusive end offsets).

funcFormatRange

func FormatRange(ranges []Range) (hdrstring, okbool)

FormatRange formats a "Range" header perRFC 7233, section 3.It only handles "Range" headers where the units is "bytes".The "Range" header is usually only specified in GET requests.

funcParseContentRange

func ParseContentRange(hdrstring) (start, length, completeLengthint64, okbool)

ParseContentRange parses a "Content-Range" header perRFC 7233, section 4.2.It only handles "Content-Range" headers where the units is "bytes".The "Content-Range" header is usually only specified in HTTP responses.

If only the completeLength is specified, then start and length are both zero.

Otherwise, the parses the start and length and the optional completeLength,which is -1 if unspecified. The start is non-negative and the length is positive.

Types

typeRange

type Range struct {// Start is the starting offset.// It is zero if Length is negative; it must not be negative.Startint64// Length is the length of the content.// It is zero if the length extends to the end of the content.// It is negative if the length is relative to the end (e.g., last 5 bytes).Lengthint64}

Range is a range of bytes within some content.

funcParseRange

func ParseRange(hdrstring) (ranges []Range, okbool)

ParseRange parses a "Range" header perRFC 7233, section 3.It only handles "Range" headers where the units is "bytes".The "Range" header is usually only specified in GET requests.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp