http

package
v0.0.0-...-435c516 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LastModified       = "Last-Modified"
	Date               = "Date"
	ETag               = "ETag"
	ContentType        = "Content-Type"
	ContentMD5         = "Content-Md5"
	ContentEncoding    = "Content-Encoding"
	Expires            = "Expires"
	ContentLength      = "Content-Length"
	ContentLanguage    = "Content-Language"
	ContentRange       = "Content-Range"
	Connection         = "Connection"
	AcceptRanges       = "Accept-Ranges"
	AmzBucketRegion    = "X-Amz-Bucket-Region"
	ServerInfo         = "Server"
	RetryAfter         = "Retry-After"
	Location           = "Location"
	CacheControl       = "Cache-Control"
	ContentDisposition = "Content-Disposition"
	Authorization      = "Authorization"
	Action             = "Action"
	Range              = "Range"
)

Standard S3 HTTP response constants

View Source
const (
	// MimeNone Means no response type.
	MimeNone mimeType = ""
	// MimeJSON Means response type is JSON.
	MimeJSON mimeType = "application/json"
	// MimeXML Means response type is XML.
	MimeXML mimeType = "application/xml"
)

Variables

This section is empty.

Functions

func EncodeResponse

func EncodeResponse(response interface{}) []byte

EncodeResponse Encodes the response headers into XML format.

func GetSourceIPFromHeaders

func GetSourceIPFromHeaders(r *http.Request) string

GetSourceIPFromHeaders retrieves the IP from the X-Forwarded-For, X-Real-IP and RFC7239 Forwarded headers (in that order)

func ParseForm

func ParseForm(r *http.Request) error

ParseForm Parses form fields

func SetCommonHeaders

func SetCommonHeaders(w http.ResponseWriter)

SetCommonHeaders writes http common headers

func TrimLeadingSlash

func TrimLeadingSlash(ep string) string

TrimLeadingSlash Cleans and ensure there is a leading slash path in the URL

func UnescapeQueryPath

func UnescapeQueryPath(ep string) (string, error)

UnescapeQueryPath URL unencode the path

func WriteResponse

func WriteResponse(w http.ResponseWriter, statusCode int, response []byte, mType mimeType)

WriteResponse writes ressponse to http.ResponseWriter

Types

This section is empty.

Jump to

Keyboard shortcuts

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