blob: c3ff3fa1c78c0870021a4fe343511fc8ce2e09da [file] [log] [blame]
// Copyright 2014 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 http2
import (
var (
commonBuildOnce sync.Once
commonLowerHeader map[string]string // Go-Canonical-Case -> lower-case
commonCanonHeader map[string]string // lower-case -> Go-Canonical-Case
func buildCommonHeaderMapsOnce() {
func buildCommonHeaderMaps() {
common := []string{
commonLowerHeader = make(map[string]string, len(common))
commonCanonHeader = make(map[string]string, len(common))
for _, v := range common {
chk := http.CanonicalHeaderKey(v)
commonLowerHeader[chk] = v
commonCanonHeader[v] = chk
func lowerHeader(v string) string {
if s, ok := commonLowerHeader[v]; ok {
return s
return strings.ToLower(v)