-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix: invalid host message is missing on clientwith https (#3997) #3998
fix: invalid host message is missing on clientwith https (#3997) #3998
Conversation
|
1abb294
to
a3f97b6
Compare
Codecov Report
@@ Coverage Diff @@
## master #3998 +/- ##
==========================================
+ Coverage 92.60% 92.69% +0.09%
==========================================
Files 14 14
Lines 1406 1410 +4
Branches 516 519 +3
==========================================
+ Hits 1302 1307 +5
+ Misses 96 95 -1
Partials 8 8
Continue to review full report at Codecov.
|
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.
Thanks
a3f97b6
to
c280fbe
Compare
For Bugs and Features; did you add new tests?
Added a new test that successfully fails with
client.terminate
Motivation / Use-Case
See #3997. When host/origin headers do not match,
client.terminate
was being called. However, when HTTPS is enabled, this message is encrypted asynchronously by NodeJS before it gets written to the socket. Therefore, whenclient.terminate
destroys the underlying socket the previoussendMessage
had not yet been written to the socket.Only applies when HTTPS is enabled.
Using
client.close
ensures that the socket is closed after all data is sent.Breaking Changes
None
Additional Info
Granted, with a bad client, this could leak forever as there is no timeout. However, I do not see timeouts elsewhere so they could be added as part of adding them elsewhere. It's also a development tool that is unlikely to be very long lived, and will be extremely easy to restart upon any issue (always attended), so it's likely timeouts would unnecessarily overcomplicate the implementation with little benefit.
I also fixed loads of warnings I was getting running tests about EventEmitter leaks due to the signal listener that is registered when creating an instance. I can remove this code from this commit if it's a problem - it seemed very minor and fine to add as part of same commit - and either omit it entirely or raise separately for you.
Fixes #3997