From c877839975014e976a41dde0045be50819199b72 Mon Sep 17 00:00:00 2001 From: Eli Lindsey Date: Tue, 11 Oct 2022 10:59:02 -0400 Subject: [PATCH] http2: add a few other common headers to the shared headermap cache This change adds additional common CORS headers and two de-facto standard and common X- headers to the shared headermap cache to cut down on allocations from lower-casing/canonicalization. Change-Id: I61121925b0b28414ed6ce07190155662b0444f93 Reviewed-on: https://go-review.googlesource.com/c/net/+/442176 Auto-Submit: Damien Neil TryBot-Result: Gopher Robot Run-TryBot: Damien Neil Reviewed-by: Ian Lance Taylor Reviewed-by: Damien Neil --- http2/headermap.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/http2/headermap.go b/http2/headermap.go index 9e12941da4..aca1646fe2 100644 --- a/http2/headermap.go +++ b/http2/headermap.go @@ -27,7 +27,14 @@ func buildCommonHeaderMaps() { "accept-language", "accept-ranges", "age", + "access-control-allow-credentials", + "access-control-allow-headers", + "access-control-allow-methods", "access-control-allow-origin", + "access-control-expose-headers", + "access-control-max-age", + "access-control-request-headers", + "access-control-request-method", "allow", "authorization", "cache-control", @@ -53,6 +60,7 @@ func buildCommonHeaderMaps() { "link", "location", "max-forwards", + "origin", "proxy-authenticate", "proxy-authorization", "range", @@ -68,6 +76,8 @@ func buildCommonHeaderMaps() { "vary", "via", "www-authenticate", + "x-forwarded-for", + "x-forwarded-proto", } commonLowerHeader = make(map[string]string, len(common)) commonCanonHeader = make(map[string]string, len(common))