1
// Copyright 2018 The Go Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
5
// Package httpguts provides functions implementing various details
6
// of the HTTP specification.
8
// This package is shared by the standard library (which vendors it)
9
// and x/net/http2. It comes with no API stability promise.
17
// ValidTrailerHeader reports whether name is a valid header field name to appear
19
// See RFC 7230, Section 4.1.2
20
func ValidTrailerHeader(name string) bool {
21
name = textproto.CanonicalMIMEHeaderKey(name)
22
if strings.HasPrefix(name, "If-") || badTrailer[name] {
28
var badTrailer = map[string]bool{
29
"Authorization": true,
30
"Cache-Control": true,
32
"Content-Encoding": true,
33
"Content-Length": true,
34
"Content-Range": true,
41
"Proxy-Authenticate": true,
42
"Proxy-Authorization": true,
43
"Proxy-Connection": true,
48
"Transfer-Encoding": true,
49
"Www-Authenticate": true,