refactor: improve TLS config handling and add bridge connection tests

This commit is contained in:
wjqserver 2026-04-02 22:13:50 +08:00
parent dcdb1504a3
commit d53693952a
3 changed files with 153 additions and 7 deletions

View file

@ -51,9 +51,10 @@ func newHTTP1BridgeTransportWithTLSConfig(tlsConfig *tls.Config) http.RoundTripp
transport := cloneDefaultTransport()
transport.Protocols = new(http.Protocols)
transport.Protocols.SetHTTP1(true)
transport.TLSClientConfig = tlsConfig
if transport.TLSClientConfig == nil {
if tlsConfig == nil {
transport.TLSClientConfig = &tls.Config{}
} else {
transport.TLSClientConfig = tlsConfig.Clone()
}
if len(transport.TLSClientConfig.NextProtos) == 0 {
transport.TLSClientConfig.NextProtos = []string{"http/1.1"}