-
-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add support for ReadHeaderTimeout #74
Conversation
I'm under the impression I'm about to learn something here but how can the coverage increase if no tests were implemented? Are the examples added here considered example tests? |
I was scratching my head about the test coverage too. I ended up just removing the examples and moving the https server to the README. I didn't want to restructure your project. |
No, no, no, please, keep the code in the |
Sounds good. Will do. |
code coverage didn't increase because of the examples. guessing it has to do with the new lines added when the deadline is set. |
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.
Overall LGTM but please remove the binaries (maybe you added them accidentally) and add tests that show that an error is thrown when a client doesn't write the header after a defined amount of time.
Whoops. Yes, that was a mistake. I will fix that and also add a test. Cheers. |
Set a read deadline when waiting for the PROXY protocol header. Fix for #65
Sorry about the premature squashing and force pushes. Didn't realize it messed with github's review system. |
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.
This is great, thank you very much!
From https://github.com/pires/go-proxyproto/releases: Prevent potentially malicious client(s) from opening connections and not send the proxy protocol header, which could lead to DoS as the server would hold those socket descriptors open indefinitely, eventually running out of resources. The solution is to set a read deadline when waiting for the PROXY protocol header: pires/go-proxyproto#74
From https://github.com/pires/go-proxyproto/releases: Prevent potentially malicious client(s) from opening connections and not send the proxy protocol header, which could lead to DoS as the server would hold those socket descriptors open indefinitely, eventually running out of resources. The solution is to set a read deadline when waiting for the PROXY protocol header: pires/go-proxyproto#74
@pires I strongly urge you to pick a suitable default for when no read timeout is set. Otherwise you put the onus on library users to know that they have to do this in order to be safe. |
Agreed. |
Set a read deadline when waiting for the PROXY protocol header.