httpfield

package
v2.0.0-dev.11 Latest Latest
Warning

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

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

Documentation

Overview

Package httpfield parses RFC 9110 list-valued header fields for the httpserver module's packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IfMatchFails

func IfMatchFails(h http.Header, etag string) bool

IfMatchFails reports whether h's If-Match, over every field line, states a condition that etag, a strong entity-tag, fails (RFC 9110 section 13.1.1). The condition holds when the field is "*" alone or lists an entity-tag strongly equal to etag (section 8.8.3.2), so a weak tag never matches. A field with no member states no condition.

func IfNoneMatch

func IfNoneMatch(h http.Header, etag string) bool

IfNoneMatch reports whether h's If-None-Match, over every field line, is "*" as the whole field or lists an entity-tag weakly equal to etag, a strong entity-tag (RFC 9110 section 13.1.2).

func List

func List(h http.Header, name string, syntax Syntax) iter.Seq[string]

List yields h's name field as one RFC 9110 section 5.6.1 list: field lines joined with "," (section 5.2), so a proxy adding a line cannot leave a client's line read alone; split at each comma outside quotes; elements trimmed of OWS; empty elements dropped. A caller bounding its elements stops the loop; the scan up to there is linear in the field's length.

Types

type Syntax

type Syntax uint8

Syntax is how a list-valued field quotes its elements, which decides whether a comma separates them (RFC 9110 section 5.6.1).

const (
	// Tokens has no quoting: a '"' is an ordinary byte, so a client's
	// stray quote cannot swallow the elements after it.
	Tokens Syntax = iota
	// QuotedStrings holds RFC 9110 section 5.6.4 quoted-strings, with
	// quoted-pair escapes.
	QuotedStrings
)

Jump to

Keyboard shortcuts

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