Skip to content

Commit

Permalink
http2: add a few other common headers to the shared headermap cache
Browse files Browse the repository at this point in the history
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 <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
  • Loading branch information
elindsey authored and neild committed Nov 1, 2022
1 parent c630100 commit c877839
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions http2/headermap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -53,6 +60,7 @@ func buildCommonHeaderMaps() {
"link",
"location",
"max-forwards",
"origin",
"proxy-authenticate",
"proxy-authorization",
"range",
Expand All @@ -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))
Expand Down

0 comments on commit c877839

Please sign in to comment.