mirror of
https://github.com/hanzoai/mail.git
synced 2026-09-23 23:53:02 +00:00
go1.27 now includes the http2 code in the standard library that was in golang.org/x/net/http2. we still call http2.ConfigureServer, but with go1.27 that just uses the code in the standard library. however, it works slightly differently, and doesn't enable http2 when we don't also explicitly enable it in the new field http.Server.Protocols. so we set that field, but obviously not for go1.26 and earlier when it didn't exist yet. with go1.27's http2.ConfigureServer, the configuration is triggered during the http.Server.Serve, later than before. since we call Serve concurrently, that resulted in race conditions during startup, causing http2 (even with http.Server.Protocols set) to be enabled only some of the time.