mirror of
https://github.com/fatedier/frp.git
synced 2026-07-23 09:19:18 +08:00
server: drop HTTP/1.1 h2c upgrade handling (#5436)
Use net/http Server.Protocols and the merged golib listener path instead of the deprecated h2c handler. Keep HTTP/1.1 and cleartext HTTP/2 prior-knowledge support, while intentionally dropping HTTP/1.1 Upgrade: h2c.
This commit is contained in:
@@ -300,10 +300,14 @@ func NewService(cfg *v1.ServerConfig) (*Service, error) {
|
||||
svr.rc.HTTPReverseProxy = rp
|
||||
|
||||
address := net.JoinHostPort(cfg.ProxyBindAddr, strconv.Itoa(cfg.VhostHTTPPort))
|
||||
protocols := new(http.Protocols)
|
||||
protocols.SetHTTP1(true)
|
||||
protocols.SetUnencryptedHTTP2(true)
|
||||
server := &http.Server{
|
||||
Addr: address,
|
||||
Handler: rp,
|
||||
ReadHeaderTimeout: 60 * time.Second,
|
||||
Protocols: protocols,
|
||||
}
|
||||
var l net.Listener
|
||||
if httpMuxOn {
|
||||
|
||||
Reference in New Issue
Block a user