headers

package
v8.7.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentDispositionHeader = "Content-Disposition"
	ContentTypeHeader        = "Content-Type"

	// Workhorse related headers
	GitlabWorkhorseSendDataHeader = "Gitlab-Workhorse-Send-Data"
	XSendFileHeader               = "X-Sendfile"
	XSendFileTypeHeader           = "X-Sendfile-Type"

	// Signal header that indicates Workhorse should detect and set the content headers
	GitlabWorkhorseDetectContentTypeHeader = "Gitlab-Workhorse-Detect-Content-Type"
)

HTTP Headers

View Source
const MaxDetectSize = 4096

Max number of bytes that http.DetectContentType needs to get the content type Fixme: Go back to 512 bytes once https://gitlab.com/gitlab-org/gitlab-workhorse/issues/208 has been merged

Variables

View Source
var (
	ImageTypeRegex   = regexp.MustCompile(`^image/*`)
	SvgMimeTypeRegex = regexp.MustCompile(`^image/svg\+xml$`)

	TextTypeRegex = regexp.MustCompile(`^text/*`)

	VideoTypeRegex = regexp.MustCompile(`^video/*`)

	AttachmentRegex = regexp.MustCompile(`^attachment`)
	InlineRegex     = regexp.MustCompile(`^inline`)
)

Functions

func AnyResponseHeaderPresent

func AnyResponseHeaderPresent(rw http.ResponseWriter) bool

AnyResponseHeaderPresent checks in the ResponseWriter if there is any Response Header

func IsDetectContentTypeHeaderPresent

func IsDetectContentTypeHeaderPresent(rw http.ResponseWriter) bool

func RemoveResponseHeaders

func RemoveResponseHeaders(rw http.ResponseWriter)

RemoveResponseHeaders removes any ResponseHeader from the ResponseWriter

func SafeContentHeaders

func SafeContentHeaders(data []byte, contentDisposition string) (string, string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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