File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,15 +53,30 @@ func NewHttpServer(port string, eh events.Handler) *HttpServer {
5353 eh : eh ,
5454 isTls : false ,
5555 }
56- s .server .Handler = s
56+ var protocols http.Protocols
57+ protocols .SetHTTP1 (true )
58+ protocols .SetUnencryptedHTTP2 (true )
59+
60+ s .server = & http.Server {
61+ Addr : fmt .Sprintf (":%v" , port ),
62+ Handler : s ,
63+ Protocols : & protocols ,
64+ }
5765 return s
5866}
5967
6068func NewHttpServerTls (port string , store * cert.Store , eh events.Handler ) * HttpServer {
6169 s := NewHttpServer (port , eh )
6270 s .server .TLSConfig = & tls.Config {
6371 GetCertificate : store .GetCertificate ,
72+ MinVersion : tls .VersionTLS12 ,
73+ MaxVersion : tls .VersionTLS13 ,
6474 }
75+ var protocols http.Protocols
76+ protocols .SetHTTP1 (true )
77+ protocols .SetHTTP2 (true )
78+
79+ s .server .Protocols = & protocols
6580 s .isTls = true
6681 return s
6782}
You can’t perform that action at this time.
0 commit comments