summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/net/http2/server.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2022-03-12 19:41:07 +0100
committerGitHub <noreply@github.com>2022-03-12 19:41:07 +0100
commitb3be2e208cb373207d6199cac5a9fc92be073e7a (patch)
tree6de6d444737edee8f0476eea87c233fa980f0002 /vendor/golang.org/x/net/http2/server.go
parentc30e90ff3f7e9ff96ac79ed4b7d90d6346216a15 (diff)
downloadmatterbridge-msglm-b3be2e208cb373207d6199cac5a9fc92be073e7a.tar.gz
matterbridge-msglm-b3be2e208cb373207d6199cac5a9fc92be073e7a.tar.bz2
matterbridge-msglm-b3be2e208cb373207d6199cac5a9fc92be073e7a.zip
Update dependencies and vendor (#1761)
Diffstat (limited to 'vendor/golang.org/x/net/http2/server.go')
-rw-r--r--vendor/golang.org/x/net/http2/server.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/vendor/golang.org/x/net/http2/server.go b/vendor/golang.org/x/net/http2/server.go
index c67e9b7f..e644d9b2 100644
--- a/vendor/golang.org/x/net/http2/server.go
+++ b/vendor/golang.org/x/net/http2/server.go
@@ -719,7 +719,15 @@ func (sc *serverConn) canonicalHeader(v string) string {
sc.canonHeader = make(map[string]string)
}
cv = http.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 unreasonable 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
}