node: disable http2 for auth API

This commit is contained in:
Sina Mahmoodi 2026-03-02 14:37:28 +01:00
parent 723aae2b4e
commit 976ee370c3
2 changed files with 8 additions and 1 deletions

View file

@ -152,8 +152,10 @@ func New(conf *Config) (*Node, error) {
// Configure RPC servers.
node.http = newHTTPServer(node.log, conf.HTTPTimeouts)
node.httpAuth = newHTTPServer(node.log, conf.HTTPTimeouts)
node.httpAuth.disableHTTP2 = true // Engine API does not need HTTP/2
node.ws = newHTTPServer(node.log, rpc.DefaultHTTPTimeouts)
node.wsAuth = newHTTPServer(node.log, rpc.DefaultHTTPTimeouts)
node.wsAuth.disableHTTP2 = true
node.ipc = newIPCServer(node.log, conf.IPCEndpoint())
return node, nil

View file

@ -90,6 +90,9 @@ type httpServer struct {
port int
handlerNames map[string]string
// disableHTTP2 disables HTTP/2 support on this server when set to true.
disableHTTP2 bool
}
const (
@ -140,7 +143,9 @@ func (h *httpServer) start() error {
h.server = &http.Server{Handler: h}
h.server.Protocols = new(http.Protocols)
h.server.Protocols.SetHTTP1(true)
h.server.Protocols.SetUnencryptedHTTP2(true)
if !h.disableHTTP2 {
h.server.Protocols.SetUnencryptedHTTP2(true)
}
if h.timeouts != (rpc.HTTPTimeouts{}) {
CheckTimeouts(&h.timeouts)
h.server.ReadTimeout = h.timeouts.ReadTimeout