Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove references to TLS1.2, to make compatible with TLS1.3 #35

Merged
merged 2 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions pkg/middleware/default_http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ limitations under the License.
package middleware

import (
"crypto/tls"
"net"
"net/http"
"time"
Expand Down Expand Up @@ -54,9 +53,6 @@ func init() {
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
TLSClientConfig: &tls.Config{
MinVersion: tls.VersionTLS12,
},
}
// We call configureHttp2TransportPing() in the package init to ensure that our defaultTransport is always configured
// with the http2 additional settings that work around the issue described here:
Expand All @@ -74,7 +70,10 @@ func init() {
})

defaultHTTPClient = &http.Client{
Transport: otelhttp.NewTransport(defaultRoundTripper, otelhttp.WithPropagators(propagation.TraceContext{})),
Transport: otelhttp.NewTransport(
defaultRoundTripper,
otelhttp.WithPropagators(propagation.TraceContext{}),
),
}
}

Expand Down
15 changes: 2 additions & 13 deletions pkg/middleware/default_http_client_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package middleware

import (
"crypto/tls"
"net/http"
"testing"

Expand All @@ -10,23 +9,13 @@ import (

func TestConfigureHttp2TransportPing(t *testing.T) {
t.Run("transport should be setup with http2Transport h2 middleware", func(t *testing.T) {
tr := &http.Transport{
TLSClientConfig: &tls.Config{
MinVersion: tls.VersionTLS12,
},
}
require.NotContains(t, tr.TLSClientConfig.NextProtos, "h2")
tr := &http.Transport{}
configureHttp2TransportPing(tr)
require.Contains(t, tr.TLSClientConfig.NextProtos, "h2")
})

t.Run("configuring transport twice panics", func(t *testing.T) {
tr := &http.Transport{
TLSClientConfig: &tls.Config{
MinVersion: tls.VersionTLS12,
},
}
require.NotContains(t, tr.TLSClientConfig.NextProtos, "h2")
tr := &http.Transport{}
require.NotPanics(t, func() { configureHttp2TransportPing(tr) })
require.Panics(t, func() { configureHttp2TransportPing(tr) })
require.Contains(t, tr.TLSClientConfig.NextProtos, "h2")
Expand Down