♻️ Refactor: Reduce the Memory Usage of ignoreHeaders (#3322)

♻️ Refactor: reduce the memory usage of ignoreHeaders

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
This commit is contained in:
Kashiwa 2025-02-24 15:12:47 +08:00 committed by GitHub
parent b1e858bc76
commit ef4effc8a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -35,17 +35,17 @@ const (
noStore = "no-store" noStore = "no-store"
) )
var ignoreHeaders = map[string]any{ var ignoreHeaders = map[string]struct{}{
"Connection": nil, "Connection": {},
"Keep-Alive": nil, "Keep-Alive": {},
"Proxy-Authenticate": nil, "Proxy-Authenticate": {},
"Proxy-Authorization": nil, "Proxy-Authorization": {},
"TE": nil, "TE": {},
"Trailers": nil, "Trailers": {},
"Transfer-Encoding": nil, "Transfer-Encoding": {},
"Upgrade": nil, "Upgrade": {},
"Content-Type": nil, // already stored explicitly by the cache manager "Content-Type": {}, // already stored explicitly by the cache manager
"Content-Encoding": nil, // already stored explicitly by the cache manager "Content-Encoding": {}, // already stored explicitly by the cache manager
} }
var cacheableStatusCodes = map[int]bool{ var cacheableStatusCodes = map[int]bool{