diff options
author | Alexander Rakoczy <alex@golang.org> | 2021-12-09 13:17:40 -0500 |
---|---|---|
committer | Alexander Rakoczy <alex@golang.org> | 2021-12-09 13:17:40 -0500 |
commit | adecd3ffbec722f69dfb5993d25f63aed5305a71 (patch) | |
tree | 11f6c90a5fda64c865ebb270e70a0aa85953b247 /src/net/http/h2_bundle.go | |
parent | c884bd9ef2f1f36a98fa89bb4be07d4f9fe66589 (diff) | |
parent | f1f3923d2e3a0952c698d2901fc052046fa4af3d (diff) | |
download | go-adecd3ffbec722f69dfb5993d25f63aed5305a71.tar.gz go-adecd3ffbec722f69dfb5993d25f63aed5305a71.zip |
[dev.boringcrypto.go1.16] all: merge go1.16.12 into dev.boringcrypto.go1.16
Change-Id: I67a17ce0d561c66c7dc85a69c464e5b4728f232f
Diffstat (limited to 'src/net/http/h2_bundle.go')
-rw-r--r-- | src/net/http/h2_bundle.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go index 735f1b5eac..6a0c1acf5f 100644 --- a/src/net/http/h2_bundle.go +++ b/src/net/http/h2_bundle.go @@ -4373,7 +4373,15 @@ func (sc *http2serverConn) canonicalHeader(v string) string { sc.canonHeader = make(map[string]string) } cv = CanonicalHeaderKey(v) - sc.canonHeader[v] = cv + // maxCachedCanonicalHeaders is an arbitrarily-chosen limit on the number of + // entries in the canonHeader cache. This should be larger than the number + // of unique, uncommon header keys likely to be sent by the peer, while not + // so high as to permit unreaasonable memory usage if the peer sends an unbounded + // number of unique header keys. + const maxCachedCanonicalHeaders = 32 + if len(sc.canonHeader) < maxCachedCanonicalHeaders { + sc.canonHeader[v] = cv + } return cv } |