request

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// SchemeHTTP name for the HTTP scheme
	SchemeHTTP = "http"
	// SchemeHTTPS name for the HTTPS scheme
	SchemeHTTPS = "https"
)

Variables

This section is empty.

Functions

func GetDomain added in v1.8.0

func GetDomain(r *http.Request) *domain.Domain

GetDomain extracts the domain from request's context

func GetHost added in v1.8.0

func GetHost(r *http.Request) string

GetHost extracts the host from request's context

func GetHostWithoutPort added in v1.13.0

func GetHostWithoutPort(r *http.Request) string

GetHostWithoutPort returns a host without the port. The host(:port) comes from a Host: header if it is provided, otherwise it is a server name.

func IsHTTPS

func IsHTTPS(r *http.Request) bool

IsHTTPS checks whether the request originated from HTTP or HTTPS. It reads the ctxHTTPSKey from the context and returns its value It also checks that r.URL.Scheme matches the value in ctxHTTPSKey for HTTPS requests TODO: remove the ctxHTTPSKey from the context https://gitlab.com/gitlab-org/gitlab-pages/issues/219

func WithHTTPSFlag

func WithHTTPSFlag(r *http.Request, https bool) *http.Request

WithHTTPSFlag saves https flag in request's context

func WithHostAndDomain added in v1.8.0

func WithHostAndDomain(r *http.Request, host string, domain *domain.Domain) *http.Request

WithHostAndDomain saves host name and domain in the request's context

Types

This section is empty.

Jump to

Keyboard shortcuts

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