Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.4k
http2: throw better error when accessing unbound socket proxy#22486
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
nodejs-github-bot commented Aug 23, 2018
szmarczak commented Aug 23, 2018
There's another ways to expose the original socket: session.socket.ref()session.socket.unref()session.socket.setEncoding()session.socket.setKeepAlive()session.socket.setNoDelay()Should these be fixed? |
BridgeAR 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.
I am not sure if this is the ideal solution but the code looks good to me.
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.
What is expected to happen sync?
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.
What do you mean?
jasnell commented Aug 23, 2018
Yeah, I'll take another look. |
3bb3522 to dc92650Comparejasnell commented Aug 24, 2018
Added additional tests for the |
jasnell commented Aug 24, 2018
Trott commented Aug 25, 2018
Resume Build: https://ci.nodejs.org/job/node-test-pull-request/16749/ |
Trott commented Aug 25, 2018 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Theoretically I personally don't know that I would have chosen an HTTP2 error for this (and others) instead of one of the existing SOCKET errors, but maybe more specific is good and I make bad decisions. 🙃 |
Trott commented Aug 25, 2018
@nodejs/http2 |
mcollina 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.
LGTM
Fixes: #22268 PR-URL: #22486 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
jasnell commented Aug 27, 2018
Landed in dd03706 |
Fixes: #22268 PR-URL: #22486 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
szmarczak commented Aug 30, 2018
@jasnell I think you missed something :P You can't do session.socket.ref()session.socket.unref()session.socket.setEncoding()session.socket.setKeepAlive()session.socket.setNoDelay()So get(session,prop){switch(prop){case'setTimeout': returnsession.setTimeout.bind(session);case'destroy': case'emit': case'end': case'pause': case'read': case'resume': case'write': case'setEncoding': case'setKeepAlive': case'setNoDelay': thrownewERR_HTTP2_NO_SOCKET_MANIPULATION();case'ref': case'unref': returnsocket[prop].bind(session.socket);default: constsocket=session[kSocket];if(socket===undefined)thrownewERR_HTTP2_SOCKET_UNBOUND();constvalue=socket[prop];returntypeofvalue==='function' ? value.bind(socket) : value;}} ... set(session,prop,value){switch(prop){case'setTimeout': session.setTimeout=value;returntrue;case'destroy': case'emit': case'end': case'pause': case'read': case'resume': case'write': case'setEncoding': case'setKeepAlive': case'setNoDelay': case'ref': case'unref': thrownewERR_HTTP2_NO_SOCKET_MANIPULATION();default: constsocket=session[kSocket];if(socket===undefined)thrownewERR_HTTP2_SOCKET_UNBOUND();socket[prop]=value;returntrue;} |
mcollina commented Aug 30, 2018
@szmarczak good spot! would you like to open a PR to fix that? |
szmarczak commented Aug 30, 2018
Yeah, sure. |
szmarczak commented Sep 2, 2018
Fixes: #22268 PR-URL: #22486 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Refs: #22486 PR-URL: #22650 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: James M Snell <[email protected]>
Refs: #22486 PR-URL: #22650 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fixes: #22268 PR-URL: #22486 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Refs: #22486 PR-URL: #22650 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fixes: nodejs#22268 PR-URL: nodejs#22486 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Refs: nodejs#22486 PR-URL: nodejs#22650 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fixes: nodejs#22268 PR-URL: nodejs#22486 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Refs: nodejs#22486 PR-URL: nodejs#22650 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fixes: #22268 Backport-PR-URL: #22850 PR-URL: #22486 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Refs: #22486 Backport-PR-URL: #22850 PR-URL: #22650 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fixes the bug in the sense that a better error message is provided. Generally speaking, once the connection has been closed, users should not continue to the use the socket proxy object. So, throw whenever they try to.
Fixes: #22268
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes