-
-
Notifications
You must be signed in to change notification settings - Fork 118
header: return err from reader.Peek() #21
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
Conversation
|
Hey @igorwwwwwwwwwwwwwwwwwwww! Thanks for the report and patch. Could you add a test that mimics your scenario so we see the TLS error actually bubbling up? And since we're at it, could you also please change all other |
|
@pires I've added a test with a reader that returns a custom error. I also added some logic to handle EOF differently. Some tests are expecting EOF to return The error handling got a bit gnarly, so if you have suggestions for how to refactor this, I'm happy to do so. |
pires
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your code seems to be easier to read that what I have so no worries there, thanks!
pires
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for your contribution!
The current behaviour of
Readis to discard the underlying error and returnErrNoProxyProtocol. That makes it tricky to debug what is wrong.In my case, I was trying to nest
tls.NewListenerinside aproxyproto.Listenerbut got the ordering wrong, the underlying error was:This patch surfaces that error to the caller.
Note: It may be a good idea to do the same thing with the other
.Peek()calls too.