http

package
v1.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ContentType   = "Content-Type"
	ContentLength = "Content-Length"
	AcceptRanges  = "Accept-Ranges"
	ServerInfo    = "Server"
)

Standard S3 HTTP response constants

View Source
const (
	// MimeNone Means no response type.
	MimeNone mimeType = ""
	// 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