queryparam

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package queryparam reads the query parameters a policy decision depends on.

The engines behind the proxy don't read a query parameter the same way. dockerd takes the first value under the exact key (net/http's Request.FormValue). Podman decodes most of its query structs with gorilla/schema v1.4.1, which matches a key to a field with strings.EqualFold and keeps the last value, and with two spellings of one key present the winner depends on map iteration order. A few Podman handlers read a parameter with url.Values.Get instead (the build's `dockerfile` and `remote`), so even one engine isn't consistent from one parameter to the next. Read from moby 28.5.1, Podman 5.8.6 and gorilla/schema v1.4.1.

The one shape every one of those readers agrees on is a parameter sent once, spelled exactly as documented, so that is the only shape these functions return a value for. A parameter repeated under any spelling, or sent in any other letter case, is reported ambiguous, and the caller refuses the request instead of guessing which engine reads which value. Spellings are compared with strings.EqualFold because that is what gorilla/schema uses, so the Unicode simple folds count too: U+017F (ſ) matches s and the Kelvin sign U+212A matches k.

The Docker CLI, the Go SDK, Compose, docker-py, dockerode and Podman's own bindings all send each scalar parameter once, under its documented spelling, so a refusal here only meets a request built by hand.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List(query url.Values, name string) (values []string, ok bool)

List returns every value of the list parameter name, in the order the request carried them.

Clients send a list by repeating the key (`t` on a build, `volume` on a Podman build, `changes` on a commit) and both engines read every value of it, so a repeat is not ambiguous here. Another spelling is: dockerd ignores it, and gorilla/schema replaces the whole list with whichever spelling it visits last. ok is false when any spelling of name other than name itself occurs. The returned slice belongs to query and must not be modified.

func Present

func Present(query url.Values, name string) bool

Present reports whether name occurs under any spelling, with any value.

It is for a parameter whose presence alone is what a policy refuses, such as a Podman build's host `volume`. Refusing every spelling there is already the strictest reading, so there is nothing ambiguous to report.

func Scalar

func Scalar(query url.Values, name string) (value string, present, ok bool)

Scalar returns the value of the single-valued parameter name.

present reports whether name occurs under any spelling. ok is false when the request is ambiguous: name occurs more than once across every spelling, or its only occurrence is spelled other than exactly name. An absent parameter is ("", false, true).

Types

This section is empty.

Jump to

Keyboard shortcuts

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