Documentation
¶
Overview ¶
Package origin compares URLs by origin: scheme, host and port. A bearer credential is sent only to the origin that issued it, so two spellings of one origin must compare equal and nothing else may: not the same host over another scheme, where the credential would travel in clear, and not the same host on another port, which can be another service.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Guard ¶
Guard returns a copy of c that never carries an Authorization header across origins. net/http keeps that header on a redirect to the same host, or to a subdomain of it, whatever the scheme or the port, so a registry's answer pointing at http:// on its own host, at another port or at a sibling subdomain would take a bearer token with it. Guard compares every hop with the origin of the request the caller sent, so a hop back to that origin gets the header again and one away from it does not. A redirect policy c already has still decides whether the redirect is followed; with none, the default limit of ten applies. A nil c is http.DefaultClient.
func Host ¶
Host is host as a request resolves it: lower-cased, without trailing dots, and a non-ASCII name in its ASCII (punycode) form, so that two spellings of one host compare equal. ok is false for a name that has no such form.
Types ¶
This section is empty.