diff options
Diffstat (limited to 'vendor/golang.org/x/net/http2/headermap.go')
-rw-r--r-- | vendor/golang.org/x/net/http2/headermap.go | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/vendor/golang.org/x/net/http2/headermap.go b/vendor/golang.org/x/net/http2/headermap.go new file mode 100644 index 0000000..c2805f6 --- /dev/null +++ b/vendor/golang.org/x/net/http2/headermap.go | |||
@@ -0,0 +1,78 @@ | |||
1 | // Copyright 2014 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. | ||
4 | |||
5 | package http2 | ||
6 | |||
7 | import ( | ||
8 | "net/http" | ||
9 | "strings" | ||
10 | ) | ||
11 | |||
12 | var ( | ||
13 | commonLowerHeader = map[string]string{} // Go-Canonical-Case -> lower-case | ||
14 | commonCanonHeader = map[string]string{} // lower-case -> Go-Canonical-Case | ||
15 | ) | ||
16 | |||
17 | func init() { | ||
18 | for _, v := range []string{ | ||
19 | "accept", | ||
20 | "accept-charset", | ||
21 | "accept-encoding", | ||
22 | "accept-language", | ||
23 | "accept-ranges", | ||
24 | "age", | ||
25 | "access-control-allow-origin", | ||
26 | "allow", | ||
27 | "authorization", | ||
28 | "cache-control", | ||
29 | "content-disposition", | ||
30 | "content-encoding", | ||
31 | "content-language", | ||
32 | "content-length", | ||
33 | "content-location", | ||
34 | "content-range", | ||
35 | "content-type", | ||
36 | "cookie", | ||
37 | "date", | ||
38 | "etag", | ||
39 | "expect", | ||
40 | "expires", | ||
41 | "from", | ||
42 | "host", | ||
43 | "if-match", | ||
44 | "if-modified-since", | ||
45 | "if-none-match", | ||
46 | "if-unmodified-since", | ||
47 | "last-modified", | ||
48 | "link", | ||
49 | "location", | ||
50 | "max-forwards", | ||
51 | "proxy-authenticate", | ||
52 | "proxy-authorization", | ||
53 | "range", | ||
54 | "referer", | ||
55 | "refresh", | ||
56 | "retry-after", | ||
57 | "server", | ||
58 | "set-cookie", | ||
59 | "strict-transport-security", | ||
60 | "trailer", | ||
61 | "transfer-encoding", | ||
62 | "user-agent", | ||
63 | "vary", | ||
64 | "via", | ||
65 | "www-authenticate", | ||
66 | } { | ||
67 | chk := http.CanonicalHeaderKey(v) | ||
68 | commonLowerHeader[chk] = v | ||
69 | commonCanonHeader[v] = chk | ||
70 | } | ||
71 | } | ||
72 | |||
73 | func lowerHeader(v string) string { | ||
74 | if s, ok := commonLowerHeader[v]; ok { | ||
75 | return s | ||
76 | } | ||
77 | return strings.ToLower(v) | ||
78 | } | ||