spdy-http2 / node-spdy

SPDY server on Node.js
2.81k stars 196 forks source link

Fix uncaught exception on prematurely terminated connections #265

Closed anandsuresh closed 7 years ago

anandsuresh commented 8 years ago

When a SPDY connection is terminated prematurely, it is possible for user-code to still hold references to the request and response objects and perform operations on them, including creating a new push stream. This condition can trigger an uncaught exception when the underlying connection has been closed.

This commit fixes an issue in the Response class by eliminating the need to read the name of the connected host using the parser attached to the socket. Instead, it uses a reference to its corresponding request object (now setup in server.js when a "request" event is fired) to read the HTTP Host header.

indutny commented 8 years ago

The fix LGTM, sorry for delay! Left one very minor comment, will land it right after it will be fixed.

Thank you!

anandsuresh commented 7 years ago

Fixed the issue @indutny. Good to merge.

indutny commented 7 years ago

LGTM

indutny commented 7 years ago

Landed and released, thank you!

anandsuresh commented 7 years ago

Much appreciated @indutny! :)