In src/net/http/internal/http2/server.go, the function newWriterAndRequest constructs a new request and its header map when parsing an incoming HTTP/2 request frame.
Currently, the map is created using make(Header) without specifying an initial capacity:
header := make(Header)
rp.Header = header
for _, hf := range f.RegularFields() {
header.Add(sc.canonicalHeader(hf.Name), hf.Value)
}
In
src/net/http/internal/http2/server.go, the functionnewWriterAndRequestconstructs a new request and its header map when parsing an incoming HTTP/2 request frame.Currently, the map is created using
make(Header)without specifying an initial capacity: