Documentation
¶
Index ¶
- Constants
- Variables
- func CopyHeader(dst, src http.Header)
- func FilterHeaders(h http.Header, allowed []string) http.Header
- func HeaderToMap(h http.Header) map[string]string
- func IsMethodValid(method string) bool
- func IsStatusCodeValid(status int) bool
- func IsSuccess(status int) bool
- func RemoveHop(h http.Header)
- func RemoveHopByHopHeaders(h http.Header)
- func UpgradeType(h http.Header) string
- type AcceptContentType
- type ContentType
- type ModifyResponseFunc
- type ModifyResponseWriter
- func (w *ModifyResponseWriter) Flush()
- func (w *ModifyResponseWriter) Header() http.Header
- func (w *ModifyResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)
- func (w *ModifyResponseWriter) Size() int
- func (w *ModifyResponseWriter) StatusCode() int
- func (w *ModifyResponseWriter) Unwrap() http.ResponseWriter
- func (w *ModifyResponseWriter) Write(b []byte) (int, error)
- func (w *ModifyResponseWriter) WriteHeader(code int)
- type ServeMux
Constants ¶
View Source
const ( HeaderXForwardedMethod = "X-Forwarded-Method" HeaderXForwardedFor = "X-Forwarded-For" HeaderXForwardedProto = "X-Forwarded-Proto" HeaderXForwardedHost = "X-Forwarded-Host" HeaderXForwardedPort = "X-Forwarded-Port" HeaderXForwardedURI = "X-Forwarded-Uri" HeaderXRealIP = "X-Real-IP" HeaderUpstreamName = "X-GoDoxy-Upstream-Name" HeaderUpstreamScheme = "X-GoDoxy-Upstream-Scheme" HeaderUpstreamHost = "X-GoDoxy-Upstream-Host" HeaderUpstreamPort = "X-GoDoxy-Upstream-Port" HeaderContentType = "Content-Type" HeaderContentLength = "Content-Length" )
View Source
const StaticFilePathPrefix = "/$gperrorpage/"
Variables ¶
View Source
var ( DefaultTransport = &http.Transport{ Proxy: http.ProxyFromEnvironment, DialContext: defaultDialer.DialContext, ForceAttemptHTTP2: true, MaxIdleConnsPerHost: 100, IdleConnTimeout: 90 * time.Second, TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 1 * time.Second, DisableCompression: true, ResponseHeaderTimeout: 60 * time.Second, WriteBufferSize: 16 * 1024, ReadBufferSize: 16 * 1024, } DefaultTransportNoTLS = func() *http.Transport { clone := DefaultTransport.Clone() clone.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} return clone }() )
Functions ¶
func CopyHeader ¶
func IsMethodValid ¶
func IsStatusCodeValid ¶
func RemoveHopByHopHeaders ¶
RemoveHopByHopHeaders removes hop-by-hop headers.
func UpgradeType ¶
Types ¶
type AcceptContentType ¶
type AcceptContentType []ContentType
func GetAccept ¶
func GetAccept(h http.Header) AcceptContentType
func (AcceptContentType) AcceptHTML ¶
func (act AcceptContentType) AcceptHTML() bool
func (AcceptContentType) AcceptJSON ¶
func (act AcceptContentType) AcceptJSON() bool
func (AcceptContentType) AcceptPlainText ¶
func (act AcceptContentType) AcceptPlainText() bool
func (AcceptContentType) IsEmpty ¶
func (act AcceptContentType) IsEmpty() bool
type ContentType ¶
type ContentType string
func GetContentType ¶
func GetContentType(h http.Header) ContentType
func (ContentType) IsHTML ¶
func (ct ContentType) IsHTML() bool
func (ContentType) IsJSON ¶
func (ct ContentType) IsJSON() bool
func (ContentType) IsPlainText ¶
func (ct ContentType) IsPlainText() bool
type ModifyResponseFunc ¶
type ModifyResponseWriter ¶
type ModifyResponseWriter struct {
// contains filtered or unexported fields
}
func NewModifyResponseWriter ¶
func NewModifyResponseWriter(w http.ResponseWriter, r *http.Request, f ModifyResponseFunc) *ModifyResponseWriter
func (*ModifyResponseWriter) Flush ¶
func (w *ModifyResponseWriter) Flush()
Flush sends any buffered data to the client.
func (*ModifyResponseWriter) Header ¶
func (w *ModifyResponseWriter) Header() http.Header
func (*ModifyResponseWriter) Hijack ¶
func (w *ModifyResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)
Hijack hijacks the connection.
func (*ModifyResponseWriter) Size ¶
func (w *ModifyResponseWriter) Size() int
func (*ModifyResponseWriter) StatusCode ¶
func (w *ModifyResponseWriter) StatusCode() int
func (*ModifyResponseWriter) Unwrap ¶
func (w *ModifyResponseWriter) Unwrap() http.ResponseWriter
func (*ModifyResponseWriter) WriteHeader ¶
func (w *ModifyResponseWriter) WriteHeader(code int)
type ServeMux ¶
func NewServeMux ¶
func NewServeMux() ServeMux
func (ServeMux) HandleFunc ¶
func (mux ServeMux) HandleFunc(pattern string, handler http.HandlerFunc) (err error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.