httpclient

package
v0.137.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 5 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 httpclient contains helpers for HTTP clients that send credentials.

Index

Constants

This section is empty.

Variables

View Source
var ErrCrossOriginRedirect = errors.New("redirect to a different origin was blocked")

ErrCrossOriginRedirect is returned when a request with credentials is redirected to another origin.

Functions

func Origin

func Origin(u *url.URL) string

Origin returns scheme://host:port for a URL, with the default port filled in. It contains no user info, path or query, so it is safe to log.

func SameOrigin

func SameOrigin(a, b *url.URL) bool

SameOrigin reports whether two URLs have the same scheme, host and effective port.

func SameOriginRedirects

func SameOriginRedirects(req *http.Request, via []*http.Request) error

SameOriginRedirects is an http.Client CheckRedirect function for requests that carry credentials. It follows a redirect only when scheme, host and port stay the same as in the first request. net/http still forwards the Authorization header to subdomains, other ports and from https to http. This function blocks those redirects before a request reaches the new target.

Types

This section is empty.

Jump to

Keyboard shortcuts

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