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

Use http.DefaultTransport with custom TLS config #1140

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cbascom
Copy link

@cbascom cbascom commented Jun 11, 2022

The HTTPDoWithOptionsE function has been updated to ensure we use
http.DefaultTransport even when custom TLS config has been provided
which ensures that HTTP/2 support is enabled in the HTTP client.

Description

Fixes #1139.

The function http_helper.HTTPDoWithOptionsE was attempting to use HTTP 1.x with TLSConfig, thus hitting the issue "net/http: HTTP/1.x transport connection broken: malformed HTTP response" .

This PR moves the mechanism that was added in #560 in method http_helper.HttpGetWithOptionsE into a new function that can be used in both places to build the HTTP client transport from http.DefaultTransport and then apply the custom TLS configuration.

I was not able to reproduce the actual error using the httptest.Server unfortunately, but new tests have been added to verify that custom TLS config can be used to successfully connect to a test server with TLS enabled. The test results for the http-helper module are here: https://gist.github.com/cbascom/f868e34f11ae7406efb927fbd9c3e1ab.

The HTTPDoWithOptionsE function has been updated to ensure we use
http.DefaultTransport even when custom TLS config has been provided
which ensures that HTTP/2 support is enabled in the HTTP client.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

http_helper.HTTPDoWithRetry does not support HTTP/2 with TLS config
1 participant