2020-02-22 17:03:30 -05:00
|
|
|
// 🚀 Fiber is an Express inspired web framework written in Go with 💖
|
|
|
|
// 📌 API Documentation: https://fiber.wiki
|
|
|
|
// 📝 Github Repository: https://github.com/gofiber/fiber
|
2020-02-21 18:06:08 +01:00
|
|
|
|
2019-12-30 07:29:42 -05:00
|
|
|
package fiber
|
|
|
|
|
|
|
|
import (
|
2020-02-05 17:37:04 +01:00
|
|
|
"bytes"
|
2020-02-12 04:02:58 +01:00
|
|
|
"fmt"
|
2020-02-05 17:37:04 +01:00
|
|
|
"net"
|
2020-01-06 18:38:39 -05:00
|
|
|
"os"
|
|
|
|
"path/filepath"
|
2019-12-30 07:29:42 -05:00
|
|
|
"regexp"
|
|
|
|
"strings"
|
2020-02-05 17:37:04 +01:00
|
|
|
"time"
|
2019-12-30 07:29:42 -05:00
|
|
|
"unsafe"
|
2020-02-13 06:48:14 +01:00
|
|
|
|
2020-02-21 18:07:43 +01:00
|
|
|
websocket "github.com/fasthttp/websocket"
|
|
|
|
schema "github.com/gorilla/schema"
|
|
|
|
fasthttp "github.com/valyala/fasthttp"
|
2019-12-30 07:29:42 -05:00
|
|
|
)
|
|
|
|
|
2020-02-13 06:48:14 +01:00
|
|
|
var schemaDecoder = schema.NewDecoder()
|
2020-03-04 12:30:29 +01:00
|
|
|
var compressResponse = fasthttp.CompressHandlerLevel(func(c *fasthttp.RequestCtx) {}, fasthttp.CompressDefaultCompression)
|
|
|
|
var websocketUpgrader = websocket.FastHTTPUpgrader{
|
2020-02-21 18:07:43 +01:00
|
|
|
ReadBufferSize: 1024,
|
|
|
|
WriteBufferSize: 1024,
|
|
|
|
CheckOrigin: func(fctx *fasthttp.RequestCtx) bool {
|
|
|
|
return true
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2020-03-04 12:30:29 +01:00
|
|
|
func groupPaths(prefix, path string) string {
|
|
|
|
if path == "/" {
|
|
|
|
path = ""
|
|
|
|
}
|
|
|
|
path = prefix + path
|
|
|
|
path = strings.Replace(path, "//", "/", -1)
|
|
|
|
return path
|
|
|
|
}
|
|
|
|
|
2019-12-30 07:29:42 -05:00
|
|
|
func getParams(path string) (params []string) {
|
2020-02-21 18:07:43 +01:00
|
|
|
if len(path) < 1 {
|
|
|
|
return
|
|
|
|
}
|
2019-12-30 07:29:42 -05:00
|
|
|
segments := strings.Split(path, "/")
|
2020-01-30 23:17:25 -05:00
|
|
|
replacer := strings.NewReplacer(":", "", "?", "")
|
2019-12-30 07:29:42 -05:00
|
|
|
for _, s := range segments {
|
|
|
|
if s == "" {
|
|
|
|
continue
|
2020-01-30 23:17:25 -05:00
|
|
|
} else if s[0] == ':' {
|
|
|
|
params = append(params, replacer.Replace(s))
|
2020-02-21 18:07:43 +01:00
|
|
|
}
|
|
|
|
if strings.Contains(s, "*") {
|
2019-12-30 07:29:42 -05:00
|
|
|
params = append(params, "*")
|
|
|
|
}
|
|
|
|
}
|
2020-02-21 18:07:43 +01:00
|
|
|
return
|
2019-12-30 07:29:42 -05:00
|
|
|
}
|
2020-02-01 19:42:40 +03:00
|
|
|
|
2019-12-30 07:29:42 -05:00
|
|
|
func getRegex(path string) (*regexp.Regexp, error) {
|
|
|
|
pattern := "^"
|
|
|
|
segments := strings.Split(path, "/")
|
|
|
|
for _, s := range segments {
|
2020-02-04 13:15:24 +02:00
|
|
|
if s == "" {
|
|
|
|
continue
|
|
|
|
}
|
2020-01-30 23:17:25 -05:00
|
|
|
if s[0] == ':' {
|
2019-12-30 07:29:42 -05:00
|
|
|
if strings.Contains(s, "?") {
|
|
|
|
pattern += "(?:/([^/]+?))?"
|
|
|
|
} else {
|
|
|
|
pattern += "/(?:([^/]+?))"
|
|
|
|
}
|
2020-01-30 23:17:25 -05:00
|
|
|
} else if s[0] == '*' {
|
2019-12-30 07:29:42 -05:00
|
|
|
pattern += "/(.*)"
|
|
|
|
} else {
|
|
|
|
pattern += "/" + s
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pattern += "/?$"
|
|
|
|
regex, err := regexp.Compile(pattern)
|
|
|
|
return regex, err
|
|
|
|
}
|
2020-02-01 19:42:40 +03:00
|
|
|
|
2020-02-21 18:07:43 +01:00
|
|
|
func getFiles(root string) (files []string, dir bool, err error) {
|
2020-02-12 01:06:39 +01:00
|
|
|
root = filepath.Clean(root)
|
2020-02-12 04:02:58 +01:00
|
|
|
if _, err := os.Lstat(root); err != nil {
|
2020-02-21 18:07:43 +01:00
|
|
|
return files, dir, fmt.Errorf("%s", err)
|
2020-02-12 04:02:58 +01:00
|
|
|
}
|
2020-01-06 18:38:39 -05:00
|
|
|
err = filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
|
|
|
|
if !info.IsDir() {
|
2020-01-11 04:59:51 +01:00
|
|
|
files = append(files, path)
|
2020-01-06 18:38:39 -05:00
|
|
|
} else {
|
2020-02-21 18:07:43 +01:00
|
|
|
dir = true
|
2020-01-06 18:38:39 -05:00
|
|
|
}
|
2020-01-11 04:59:51 +01:00
|
|
|
return err
|
2020-01-06 18:38:39 -05:00
|
|
|
})
|
2020-02-21 18:07:43 +01:00
|
|
|
return
|
2020-01-06 18:38:39 -05:00
|
|
|
}
|
2020-02-01 19:42:40 +03:00
|
|
|
|
2020-01-30 23:17:25 -05:00
|
|
|
func getType(ext string) (mime string) {
|
2020-02-06 21:34:36 +01:00
|
|
|
if ext == "" {
|
|
|
|
return mime
|
|
|
|
}
|
2020-01-30 23:17:25 -05:00
|
|
|
if ext[0] == '.' {
|
2020-02-21 18:07:43 +01:00
|
|
|
mime = extensionMIME[ext[1:]]
|
|
|
|
} else {
|
|
|
|
mime = extensionMIME[ext]
|
2020-01-30 23:17:25 -05:00
|
|
|
}
|
|
|
|
if mime == "" {
|
2020-02-21 18:07:43 +01:00
|
|
|
return MIMEOctetStream
|
2020-01-30 23:17:25 -05:00
|
|
|
}
|
|
|
|
return mime
|
2019-12-30 07:29:42 -05:00
|
|
|
}
|
2020-02-01 19:42:40 +03:00
|
|
|
|
2020-02-03 13:40:50 +01:00
|
|
|
// #nosec G103
|
|
|
|
// getString converts byte slice to a string without memory allocation.
|
|
|
|
// See https://groups.google.com/forum/#!msg/Golang-Nuts/ENgbUzYvCuU/90yGx7GUAgAJ .
|
2020-02-26 19:31:43 -05:00
|
|
|
var getString = func(b []byte) string {
|
2020-01-30 23:17:25 -05:00
|
|
|
return *(*string)(unsafe.Pointer(&b))
|
2020-01-11 04:59:51 +01:00
|
|
|
}
|
2020-02-01 19:42:40 +03:00
|
|
|
|
2020-02-03 13:40:50 +01:00
|
|
|
// #nosec G103
|
|
|
|
// getBytes converts string to a byte slice without memory allocation.
|
|
|
|
// See https://groups.google.com/forum/#!msg/Golang-Nuts/ENgbUzYvCuU/90yGx7GUAgAJ .
|
2020-03-04 12:30:29 +01:00
|
|
|
var getBytes = func(s string) (b []byte) {
|
2020-02-21 18:07:43 +01:00
|
|
|
return *(*[]byte)(unsafe.Pointer(&s))
|
2020-01-11 04:59:51 +01:00
|
|
|
}
|
2020-02-05 17:37:04 +01:00
|
|
|
|
2020-02-06 21:34:36 +01:00
|
|
|
// https://golang.org/src/net/net.go#L113
|
2020-02-21 18:07:43 +01:00
|
|
|
// Helper methods for application#test
|
|
|
|
type testConn struct {
|
2020-02-05 17:37:04 +01:00
|
|
|
net.Conn
|
|
|
|
r bytes.Buffer
|
|
|
|
w bytes.Buffer
|
|
|
|
}
|
|
|
|
|
2020-02-21 18:07:43 +01:00
|
|
|
func (c *testConn) RemoteAddr() net.Addr {
|
2020-02-05 17:37:04 +01:00
|
|
|
return &net.TCPAddr{
|
2020-02-06 21:34:36 +01:00
|
|
|
IP: net.IPv4(0, 0, 0, 0),
|
2020-02-05 17:37:04 +01:00
|
|
|
}
|
|
|
|
}
|
2020-02-21 18:07:43 +01:00
|
|
|
func (c *testConn) LocalAddr() net.Addr { return c.RemoteAddr() }
|
|
|
|
func (c *testConn) Read(b []byte) (int, error) { return c.r.Read(b) }
|
|
|
|
func (c *testConn) Write(b []byte) (int, error) { return c.w.Write(b) }
|
|
|
|
func (c *testConn) Close() error { return nil }
|
|
|
|
func (c *testConn) SetDeadline(t time.Time) error { return nil }
|
|
|
|
func (c *testConn) SetReadDeadline(t time.Time) error { return nil }
|
|
|
|
func (c *testConn) SetWriteDeadline(t time.Time) error { return nil }
|
|
|
|
|
2020-02-26 19:31:43 -05:00
|
|
|
// MIME types
|
|
|
|
const (
|
|
|
|
MIMEApplicationJSON = "application/json"
|
|
|
|
MIMEApplicationJavaScript = "application/javascript"
|
|
|
|
MIMEApplicationXML = "application/xml"
|
|
|
|
MIMETextXML = "text/xml"
|
|
|
|
MIMEApplicationForm = "application/x-www-form-urlencoded"
|
|
|
|
MIMEApplicationProtobuf = "application/protobuf"
|
|
|
|
MIMEApplicationMsgpack = "application/msgpack"
|
|
|
|
MIMETextHTML = "text/html"
|
|
|
|
MIMETextPlain = "text/plain"
|
|
|
|
MIMEMultipartForm = "multipart/form-data"
|
|
|
|
MIMEOctetStream = "application/octet-stream"
|
|
|
|
)
|
|
|
|
|
2020-03-04 12:30:29 +01:00
|
|
|
// HTTP status codes with messages
|
|
|
|
var statusMessages = map[int]string{
|
2020-02-10 01:24:59 +01:00
|
|
|
100: "Continue",
|
|
|
|
101: "Switching Protocols",
|
|
|
|
102: "Processing",
|
|
|
|
200: "OK",
|
|
|
|
201: "Created",
|
|
|
|
202: "Accepted",
|
|
|
|
203: "Non-Authoritative Information",
|
|
|
|
204: "No Content",
|
|
|
|
205: "Reset Content",
|
|
|
|
206: "Partial Content",
|
|
|
|
207: "Multi-Status",
|
|
|
|
208: "Already Reported",
|
|
|
|
226: "IM Used",
|
|
|
|
300: "Multiple Choices",
|
|
|
|
301: "Moved Permanently",
|
|
|
|
302: "Found",
|
|
|
|
303: "See Other",
|
|
|
|
304: "Not Modified",
|
|
|
|
305: "Use Proxy",
|
|
|
|
306: "Switch Proxy",
|
|
|
|
307: "Temporary Redirect",
|
|
|
|
308: "Permanent Redirect",
|
|
|
|
400: "Bad Request",
|
|
|
|
401: "Unauthorized",
|
|
|
|
402: "Payment Required",
|
|
|
|
403: "Forbidden",
|
|
|
|
404: "Not Found",
|
|
|
|
405: "Method Not Allowed",
|
|
|
|
406: "Not Acceptable",
|
|
|
|
407: "Proxy Authentication Required",
|
|
|
|
408: "Request Timeout",
|
|
|
|
409: "Conflict",
|
|
|
|
410: "Gone",
|
|
|
|
411: "Length Required",
|
|
|
|
412: "Precondition Failed",
|
|
|
|
413: "Request Entity Too Large",
|
|
|
|
414: "Request URI Too Long",
|
|
|
|
415: "Unsupported Media Type",
|
|
|
|
416: "Requested Range Not Satisfiable",
|
|
|
|
417: "Expectation Failed",
|
|
|
|
418: "I'm a teapot",
|
|
|
|
422: "Unprocessable Entity",
|
|
|
|
423: "Locked",
|
|
|
|
424: "Failed Dependency",
|
|
|
|
426: "Upgrade Required",
|
|
|
|
428: "Precondition Required",
|
|
|
|
429: "Too Many Requests",
|
|
|
|
431: "Request Header Fields Too Large",
|
|
|
|
451: "Unavailable For Legal Reasons",
|
|
|
|
500: "Internal Server Error",
|
|
|
|
501: "Not Implemented",
|
|
|
|
502: "Bad Gateway",
|
|
|
|
503: "Service Unavailable",
|
|
|
|
504: "Gateway Timeout",
|
|
|
|
505: "HTTP Version Not Supported",
|
|
|
|
506: "Variant Also Negotiates",
|
|
|
|
507: "Insufficient Storage",
|
|
|
|
508: "Loop Detected",
|
|
|
|
510: "Not Extended",
|
|
|
|
511: "Network Authentication Required",
|
|
|
|
}
|
|
|
|
|
2020-02-26 19:31:43 -05:00
|
|
|
// File extensions MIME types
|
2020-02-21 18:07:43 +01:00
|
|
|
var extensionMIME = map[string]string{
|
2020-02-10 01:24:59 +01:00
|
|
|
"html": "text/html",
|
|
|
|
"htm": "text/html",
|
|
|
|
"shtml": "text/html",
|
|
|
|
"css": "text/css",
|
|
|
|
"gif": "image/gif",
|
|
|
|
"jpeg": "image/jpeg",
|
|
|
|
"jpg": "image/jpeg",
|
2020-02-11 05:44:05 +01:00
|
|
|
"xml": "application/xml",
|
2020-02-10 01:24:59 +01:00
|
|
|
"js": "application/javascript",
|
|
|
|
"atom": "application/atom+xml",
|
|
|
|
"rss": "application/rss+xml",
|
|
|
|
"mml": "text/mathml",
|
|
|
|
"txt": "text/plain",
|
|
|
|
"jad": "text/vnd.sun.j2me.app-descriptor",
|
|
|
|
"wml": "text/vnd.wap.wml",
|
|
|
|
"htc": "text/x-component",
|
|
|
|
"png": "image/png",
|
|
|
|
"svg": "image/svg+xml",
|
|
|
|
"svgz": "image/svg+xml",
|
|
|
|
"tif": "image/tiff",
|
|
|
|
"tiff": "image/tiff",
|
|
|
|
"wbmp": "image/vnd.wap.wbmp",
|
|
|
|
"webp": "image/webp",
|
|
|
|
"ico": "image/x-icon",
|
|
|
|
"jng": "image/x-jng",
|
|
|
|
"bmp": "image/x-ms-bmp",
|
|
|
|
"woff": "font/woff",
|
|
|
|
"woff2": "font/woff2",
|
|
|
|
"jar": "application/java-archive",
|
|
|
|
"war": "application/java-archive",
|
|
|
|
"ear": "application/java-archive",
|
|
|
|
"json": "application/json",
|
|
|
|
"hqx": "application/mac-binhex40",
|
|
|
|
"doc": "application/msword",
|
|
|
|
"pdf": "application/pdf",
|
|
|
|
"ps": "application/postscript",
|
|
|
|
"eps": "application/postscript",
|
|
|
|
"ai": "application/postscript",
|
|
|
|
"rtf": "application/rtf",
|
|
|
|
"m3u8": "application/vnd.apple.mpegurl",
|
|
|
|
"kml": "application/vnd.google-earth.kml+xml",
|
|
|
|
"kmz": "application/vnd.google-earth.kmz",
|
|
|
|
"xls": "application/vnd.ms-excel",
|
|
|
|
"eot": "application/vnd.ms-fontobject",
|
|
|
|
"ppt": "application/vnd.ms-powerpoint",
|
|
|
|
"odg": "application/vnd.oasis.opendocument.graphics",
|
|
|
|
"odp": "application/vnd.oasis.opendocument.presentation",
|
|
|
|
"ods": "application/vnd.oasis.opendocument.spreadsheet",
|
|
|
|
"odt": "application/vnd.oasis.opendocument.text",
|
|
|
|
"wmlc": "application/vnd.wap.wmlc",
|
|
|
|
"7z": "application/x-7z-compressed",
|
|
|
|
"cco": "application/x-cocoa",
|
|
|
|
"jardiff": "application/x-java-archive-diff",
|
|
|
|
"jnlp": "application/x-java-jnlp-file",
|
|
|
|
"run": "application/x-makeself",
|
|
|
|
"pl": "application/x-perl",
|
|
|
|
"pm": "application/x-perl",
|
|
|
|
"prc": "application/x-pilot",
|
|
|
|
"pdb": "application/x-pilot",
|
|
|
|
"rar": "application/x-rar-compressed",
|
|
|
|
"rpm": "application/x-redhat-package-manager",
|
|
|
|
"sea": "application/x-sea",
|
|
|
|
"swf": "application/x-shockwave-flash",
|
|
|
|
"sit": "application/x-stuffit",
|
|
|
|
"tcl": "application/x-tcl",
|
|
|
|
"tk": "application/x-tcl",
|
|
|
|
"der": "application/x-x509-ca-cert",
|
|
|
|
"pem": "application/x-x509-ca-cert",
|
|
|
|
"crt": "application/x-x509-ca-cert",
|
|
|
|
"xpi": "application/x-xpinstall",
|
|
|
|
"xhtml": "application/xhtml+xml",
|
|
|
|
"xspf": "application/xspf+xml",
|
|
|
|
"zip": "application/zip",
|
|
|
|
"bin": "application/octet-stream",
|
|
|
|
"exe": "application/octet-stream",
|
|
|
|
"dll": "application/octet-stream",
|
|
|
|
"deb": "application/octet-stream",
|
|
|
|
"dmg": "application/octet-stream",
|
|
|
|
"iso": "application/octet-stream",
|
|
|
|
"img": "application/octet-stream",
|
|
|
|
"msi": "application/octet-stream",
|
|
|
|
"msp": "application/octet-stream",
|
|
|
|
"msm": "application/octet-stream",
|
|
|
|
"mid": "audio/midi",
|
|
|
|
"midi": "audio/midi",
|
|
|
|
"kar": "audio/midi",
|
|
|
|
"mp3": "audio/mpeg",
|
|
|
|
"ogg": "audio/ogg",
|
|
|
|
"m4a": "audio/x-m4a",
|
|
|
|
"ra": "audio/x-realaudio",
|
|
|
|
"3gpp": "video/3gpp",
|
|
|
|
"3gp": "video/3gpp",
|
|
|
|
"ts": "video/mp2t",
|
|
|
|
"mp4": "video/mp4",
|
|
|
|
"mpeg": "video/mpeg",
|
|
|
|
"mpg": "video/mpeg",
|
|
|
|
"mov": "video/quicktime",
|
|
|
|
"webm": "video/webm",
|
|
|
|
"flv": "video/x-flv",
|
|
|
|
"m4v": "video/x-m4v",
|
|
|
|
"mng": "video/x-mng",
|
|
|
|
"asx": "video/x-ms-asf",
|
|
|
|
"asf": "video/x-ms-asf",
|
|
|
|
"wmv": "video/x-ms-wmv",
|
|
|
|
"avi": "video/x-msvideo",
|
|
|
|
}
|
2020-02-28 06:41:48 +01:00
|
|
|
|
|
|
|
// HTTP Headers
|
|
|
|
const (
|
|
|
|
// Authentication
|
|
|
|
HeaderAuthorization = "Authorization"
|
|
|
|
HeaderProxyAuthenticate = "Proxy-Authenticate"
|
|
|
|
HeaderProxyAuthorization = "Proxy-Authorization"
|
|
|
|
HeaderWWWAuthenticate = "WWW-Authenticate"
|
|
|
|
|
|
|
|
// Caching
|
|
|
|
HeaderAge = "Age"
|
|
|
|
HeaderCacheControl = "Cache-Control"
|
|
|
|
HeaderClearSiteData = "Clear-Site-Data"
|
|
|
|
HeaderExpires = "Expires"
|
|
|
|
HeaderPragma = "Pragma"
|
|
|
|
HeaderWarning = "Warning"
|
|
|
|
|
|
|
|
// Client hints
|
|
|
|
HeaderAcceptCH = "Accept-CH"
|
|
|
|
HeaderAcceptCHLifetime = "Accept-CH-Lifetime"
|
|
|
|
HeaderContentDPR = "Content-DPR"
|
|
|
|
HeaderDPR = "DPR"
|
|
|
|
HeaderEarlyData = "Early-Data"
|
|
|
|
HeaderSaveData = "Save-Data"
|
|
|
|
HeaderViewportWidth = "Viewport-Width"
|
|
|
|
HeaderWidth = "Width"
|
|
|
|
|
|
|
|
// Conditionals
|
|
|
|
HeaderETag = "ETag"
|
|
|
|
HeaderIfMatch = "If-Match"
|
|
|
|
HeaderIfModifiedSince = "If-Modified-Since"
|
|
|
|
HeaderIfNoneMatch = "If-None-Match"
|
|
|
|
HeaderIfUnmodifiedSince = "If-Unmodified-Since"
|
|
|
|
HeaderLastModified = "Last-Modified"
|
|
|
|
HeaderVary = "Vary"
|
|
|
|
|
|
|
|
// Connection management
|
|
|
|
HeaderConnection = "Connection"
|
|
|
|
HeaderKeepAlive = "Keep-Alive"
|
|
|
|
|
|
|
|
// Content negotiation
|
|
|
|
HeaderAccept = "Accept"
|
|
|
|
HeaderAcceptCharset = "Accept-Charset"
|
|
|
|
HeaderAcceptEncoding = "Accept-Encoding"
|
|
|
|
HeaderAcceptLanguage = "Accept-Language"
|
|
|
|
|
|
|
|
// Controls
|
|
|
|
HeaderCookie = "Cookie"
|
|
|
|
HeaderExpect = "Expect"
|
|
|
|
HeaderMaxForwards = "Max-Forwards"
|
|
|
|
HeaderSetCookie = "Set-Cookie"
|
|
|
|
|
|
|
|
// CORS
|
|
|
|
HeaderAccessControlAllowCredentials = "Access-Control-Allow-Credentials"
|
|
|
|
HeaderAccessControlAllowHeaders = "Access-Control-Allow-Headers"
|
|
|
|
HeaderAccessControlAllowMethods = "Access-Control-Allow-Methods"
|
|
|
|
HeaderAccessControlAllowOrigin = "Access-Control-Allow-Origin"
|
|
|
|
HeaderAccessControlExposeHeaders = "Access-Control-Expose-Headers"
|
|
|
|
HeaderAccessControlMaxAge = "Access-Control-Max-Age"
|
|
|
|
HeaderAccessControlRequestHeaders = "Access-Control-Request-Headers"
|
|
|
|
HeaderAccessControlRequestMethod = "Access-Control-Request-Method"
|
|
|
|
HeaderOrigin = "Origin"
|
|
|
|
HeaderTimingAllowOrigin = "Timing-Allow-Origin"
|
|
|
|
HeaderXPermittedCrossDomainPolicies = "X-Permitted-Cross-Domain-Policies"
|
|
|
|
|
|
|
|
// Do Not Track
|
|
|
|
HeaderDNT = "DNT"
|
|
|
|
HeaderTk = "Tk"
|
|
|
|
|
|
|
|
// Downloads
|
|
|
|
HeaderContentDisposition = "Content-Disposition"
|
|
|
|
|
|
|
|
// Message body information
|
|
|
|
HeaderContentEncoding = "Content-Encoding"
|
|
|
|
HeaderContentLanguage = "Content-Language"
|
|
|
|
HeaderContentLength = "Content-Length"
|
|
|
|
HeaderContentLocation = "Content-Location"
|
|
|
|
HeaderContentType = "Content-Type"
|
|
|
|
|
|
|
|
// Proxies
|
|
|
|
HeaderForwarded = "Forwarded"
|
|
|
|
HeaderVia = "Via"
|
|
|
|
HeaderXForwardedFor = "X-Forwarded-For"
|
|
|
|
HeaderXForwardedHost = "X-Forwarded-Host"
|
|
|
|
HeaderXForwardedProto = "X-Forwarded-Proto"
|
|
|
|
|
|
|
|
// Redirects
|
|
|
|
HeaderLocation = "Location"
|
|
|
|
|
|
|
|
// Request context
|
|
|
|
HeaderFrom = "From"
|
|
|
|
HeaderHost = "Host"
|
|
|
|
HeaderReferer = "Referer"
|
|
|
|
HeaderReferrerPolicy = "Referrer-Policy"
|
|
|
|
HeaderUserAgent = "User-Agent"
|
|
|
|
|
|
|
|
// Response context
|
|
|
|
HeaderAllow = "Allow"
|
|
|
|
HeaderServer = "Server"
|
|
|
|
|
|
|
|
// Range requests
|
|
|
|
HeaderAcceptRanges = "Accept-Ranges"
|
|
|
|
HeaderContentRange = "Content-Range"
|
|
|
|
HeaderIfRange = "If-Range"
|
|
|
|
HeaderRange = "Range"
|
|
|
|
|
|
|
|
// Security
|
|
|
|
HeaderContentSecurityPolicy = "Content-Security-Policy"
|
|
|
|
HeaderContentSecurityPolicyReportOnly = "Content-Security-Policy-Report-Only"
|
|
|
|
HeaderCrossOriginResourcePolicy = "Cross-Origin-Resource-Policy"
|
|
|
|
HeaderExpectCT = "Expect-CT"
|
|
|
|
HeaderFeaturePolicy = "Feature-Policy"
|
|
|
|
HeaderPublicKeyPins = "Public-Key-Pins"
|
|
|
|
HeaderPublicKeyPinsReportOnly = "Public-Key-Pins-Report-Only"
|
|
|
|
HeaderStrictTransportSecurity = "Strict-Transport-Security"
|
|
|
|
HeaderUpgradeInsecureRequests = "Upgrade-Insecure-Requests"
|
|
|
|
HeaderXContentTypeOptions = "X-Content-Type-Options"
|
|
|
|
HeaderXDownloadOptions = "X-Download-Options"
|
|
|
|
HeaderXFrameOptions = "X-Frame-Options"
|
|
|
|
HeaderXPoweredBy = "X-Powered-By"
|
|
|
|
HeaderXXSSProtection = "X-XSS-Protection"
|
|
|
|
|
|
|
|
// Server-sent event
|
|
|
|
HeaderLastEventID = "Last-Event-ID"
|
|
|
|
HeaderNEL = "NEL"
|
|
|
|
HeaderPingFrom = "Ping-From"
|
|
|
|
HeaderPingTo = "Ping-To"
|
|
|
|
HeaderReportTo = "Report-To"
|
|
|
|
|
|
|
|
// Transfer coding
|
|
|
|
HeaderTE = "TE"
|
|
|
|
HeaderTrailer = "Trailer"
|
|
|
|
HeaderTransferEncoding = "Transfer-Encoding"
|
|
|
|
|
|
|
|
// WebSockets
|
|
|
|
HeaderSecWebSocketAccept = "Sec-WebSocket-Accept"
|
|
|
|
HeaderSecWebSocketExtensions = "Sec-WebSocket-Extensions"
|
|
|
|
HeaderSecWebSocketKey = "Sec-WebSocket-Key"
|
|
|
|
HeaderSecWebSocketProtocol = "Sec-WebSocket-Protocol"
|
|
|
|
HeaderSecWebSocketVersion = "Sec-WebSocket-Version"
|
|
|
|
|
|
|
|
// Other
|
|
|
|
HeaderAcceptPatch = "Accept-Patch"
|
|
|
|
HeaderAcceptPushPolicy = "Accept-Push-Policy"
|
|
|
|
HeaderAcceptSignature = "Accept-Signature"
|
|
|
|
HeaderAltSvc = "Alt-Svc"
|
|
|
|
HeaderDate = "Date"
|
|
|
|
HeaderIndex = "Index"
|
|
|
|
HeaderLargeAllocation = "Large-Allocation"
|
|
|
|
HeaderLink = "Link"
|
|
|
|
HeaderPushPolicy = "Push-Policy"
|
|
|
|
HeaderRetryAfter = "Retry-After"
|
|
|
|
HeaderServerTiming = "Server-Timing"
|
|
|
|
HeaderSignature = "Signature"
|
|
|
|
HeaderSignedHeaders = "Signed-Headers"
|
|
|
|
HeaderSourceMap = "SourceMap"
|
|
|
|
HeaderUpgrade = "Upgrade"
|
|
|
|
HeaderXDNSPrefetchControl = "X-DNS-Prefetch-Control"
|
|
|
|
HeaderXPingback = "X-Pingback"
|
2020-03-01 06:56:41 +01:00
|
|
|
HeaderXRequestID = "X-Request-ID"
|
2020-02-28 06:41:48 +01:00
|
|
|
HeaderXRequestedWith = "X-Requested-With"
|
|
|
|
HeaderXRobotsTag = "X-Robots-Tag"
|
|
|
|
HeaderXUACompatible = "X-UA-Compatible"
|
|
|
|
)
|