.github
alerting
client
config
controller
core
docs
example
jsonpath
k8s
k8stest
metric
pattern
security
storage
util
vendor
cloud.google.com
github.com
go.etcd.io
golang.org
x
crypto
net
bpf
context
http
httpguts
guts.go
httplex.go
http2
icmp
idna
internal
ipv4
ipv6
AUTHORS
CONTRIBUTORS
LICENSE
PATENTS
oauth2
sys
term
text
time
google.golang.org
gopkg.in
k8s.io
sigs.k8s.io
modules.txt
watchdog
web
.dockerignore
.gitattributes
.gitignore
Dockerfile
LICENSE.md
Makefile
README.md
config.yaml
go.mod
go.sum
main.go
51 lines
1.4 KiB
Go
51 lines
1.4 KiB
Go
// Copyright 2018 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// Package httpguts provides functions implementing various details
|
|
// of the HTTP specification.
|
|
//
|
|
// This package is shared by the standard library (which vendors it)
|
|
// and x/net/http2. It comes with no API stability promise.
|
|
package httpguts
|
|
|
|
import (
|
|
"net/textproto"
|
|
"strings"
|
|
)
|
|
|
|
// ValidTrailerHeader reports whether name is a valid header field name to appear
|
|
// in trailers.
|
|
// See RFC 7230, Section 4.1.2
|
|
func ValidTrailerHeader(name string) bool {
|
|
name = textproto.CanonicalMIMEHeaderKey(name)
|
|
if strings.HasPrefix(name, "If-") || badTrailer[name] {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
var badTrailer = map[string]bool{
|
|
"Authorization": true,
|
|
"Cache-Control": true,
|
|
"Connection": true,
|
|
"Content-Encoding": true,
|
|
"Content-Length": true,
|
|
"Content-Range": true,
|
|
"Content-Type": true,
|
|
"Expect": true,
|
|
"Host": true,
|
|
"Keep-Alive": true,
|
|
"Max-Forwards": true,
|
|
"Pragma": true,
|
|
"Proxy-Authenticate": true,
|
|
"Proxy-Authorization": true,
|
|
"Proxy-Connection": true,
|
|
"Range": true,
|
|
"Realm": true,
|
|
"Te": true,
|
|
"Trailer": true,
|
|
"Transfer-Encoding": true,
|
|
"Www-Authenticate": true,
|
|
}
|