httprequest

package
v4.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 1, 2019 License: Apache-2.0 Imports: 4 Imported by: 135

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrefersHTML

func PrefersHTML(req *http.Request) bool

PrefersHTML returns true if the request was made by something that looks like a browser, or can receive HTML

func SchemeHost added in v1.3.0

func SchemeHost(req *http.Request) (string, string)

SchemeHost returns the scheme and host used to make this request. Suitable for use to compute scheme/host in returned 302 redirect Location. Note the returned host is not normalized, and may or may not contain a port. Returned values are based on the following information:

Host: * X-Forwarded-Host/X-Forwarded-Port headers * Host field on the request (parsed from Host header) * Host in the request's URL (parsed from Request-Line)

Scheme: * X-Forwarded-Proto header * Existence of TLS information on the request implies https * Scheme in the request's URL (parsed from Request-Line) * Port (if included in calculated Host value, 443 implies https) * Otherwise, defaults to "http"

Types

This section is empty.

Jump to

Keyboard shortcuts

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