Skip to content

Conversation

emersion
Copy link
Contributor

When dealing with slow networks and TLS, 200ms is often hit. Bump
the default timeout to 10s, which is what crupto/tls uses for the
TLS handshake.

Closes: #83

When dealing with slow networks and TLS, 200ms is often hit. Bump
the default timeout to 10s, which is what crupto/tls uses for the
TLS handshake.

Closes: pires#83
@coveralls
Copy link

Coverage Status

Coverage remained the same at 95.543% when pulling 7f1f93d on emersion:default-timeout into 2e44d7a on pires:main.

@@ -12,7 +12,7 @@ import (
// be read from the wire, if Listener.ReaderHeaderTimeout is not set.
// It's kept as a global variable so to make it easier to find and override,
// e.g. go build -ldflags -X "github.com/pires/go-proxyproto.DefaultReadHeaderTimeout=1s"
var DefaultReadHeaderTimeout = 200 * time.Millisecond
var DefaultReadHeaderTimeout = 10 * time.Second
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add the reason here why this timeout? Or maybe just point to whatever const/var you mentioned is exposed by stdlib.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no other reason than "it's a reasonable timeout".

@@ -265,6 +265,8 @@ func TestReadHeaderTimeoutIsReset(t *testing.T) {
// we expect the actual address and port to be returned,
// rather than the ProxyHeader we defined.
func TestReadHeaderTimeoutIsEmpty(t *testing.T) {
DefaultReadHeaderTimeout = 200 * time.Millisecond
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this may have impact on subsequent tests, so maybe override the listener timeout instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point of the test is to check the default.

@emersion
Copy link
Contributor Author

Gentle ping

@pires
Copy link
Owner

pires commented Apr 26, 2022

Sorry @emersion in between work and sickness, I just haven't been able to look into this. Thanks a lot for your contribution, once more!

Copy link
Owner

@pires pires left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pires pires merged commit 1966d35 into pires:main Apr 26, 2022
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.

DefaultReadHeaderTimeout is too strict
3 participants