Disable HTTP/2 by default for the plugins https2http and https2https, and make it configurable.

This commit is contained in:
fatedier 2024-07-08 17:50:36 +08:00
parent c6f9d8d403
commit 20c559870a
5 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,7 @@
### Features
* Added a new plugin "http2http" which allows forwarding HTTP requests to another HTTP server, supporting options like local address binding, host header rewrite, and custom request headers.
### Changes
* Disable HTTP/2 by default for the plugins https2http and https2https, and make it configurable.

View File

@ -108,6 +108,7 @@ type HTTPS2HTTPPluginOptions struct {
LocalAddr string `json:"localAddr,omitempty"`
HostHeaderRewrite string `json:"hostHeaderRewrite,omitempty"`
RequestHeaders HeaderOperations `json:"requestHeaders,omitempty"`
EnableHTTP2 bool `json:"enableHTTP2,omitempty"`
CrtPath string `json:"crtPath,omitempty"`
KeyPath string `json:"keyPath,omitempty"`
}
@ -117,6 +118,7 @@ type HTTPS2HTTPSPluginOptions struct {
LocalAddr string `json:"localAddr,omitempty"`
HostHeaderRewrite string `json:"hostHeaderRewrite,omitempty"`
RequestHeaders HeaderOperations `json:"requestHeaders,omitempty"`
EnableHTTP2 bool `json:"enableHTTP2,omitempty"`
CrtPath string `json:"crtPath,omitempty"`
KeyPath string `json:"keyPath,omitempty"`
}

View File

@ -91,6 +91,9 @@ func NewHTTPS2HTTPPlugin(options v1.ClientPluginOptions) (Plugin, error) {
ReadHeaderTimeout: 60 * time.Second,
TLSConfig: tlsConfig,
}
if !opts.EnableHTTP2 {
p.s.TLSNextProto = make(map[string]func(*http.Server, *tls.Conn, http.Handler))
}
go func() {
_ = p.s.ServeTLS(listener, "", "")

View File

@ -97,6 +97,9 @@ func NewHTTPS2HTTPSPlugin(options v1.ClientPluginOptions) (Plugin, error) {
ReadHeaderTimeout: 60 * time.Second,
TLSConfig: tlsConfig,
}
if !opts.EnableHTTP2 {
p.s.TLSNextProto = make(map[string]func(*http.Server, *tls.Conn, http.Handler))
}
go func() {
_ = p.s.ServeTLS(listener, "", "")

View File

@ -14,7 +14,7 @@
package version
var version = "0.58.1"
var version = "0.59.0"
func Full() string {
return version