| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
@jasnell build started: https://ci.nodejs.org/blue/organizations/jenkins/node-test-pull-request-lite-pipeline/detail/node-test-pull-request-lite-pipeline/651/pipeline |
Sorry, something went wrong.
|
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? |
Sorry, something went wrong.
There was a problem hiding this comment.
I am not sure if this is the ideal solution but the code looks good to me.
Sorry, something went wrong.
There was a problem hiding this comment.
What is expected to happen sync?
Sorry, something went wrong.
There was a problem hiding this comment.
What do you mean?
Sorry, something went wrong.
Yeah, I'll take another look. |
Sorry, something went wrong.
|
Added additional tests for the ref(), unref(), setEncoding(), setKeepAlive(), and setNoDelay() functions. |
Sorry, something went wrong.
Sorry, something went wrong.
|
Resume Build: https://ci.nodejs.org/job/node-test-pull-request/16749/ |
Sorry, something went wrong.
|
Theoretically semver-major (I think?) if it doesn't end up in the same release as the "HTTP/2 is stable!" thing, so let's get this thing landed. 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. 🙃 |
Sorry, something went wrong.
|
@nodejs/http2 |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
|
@jasnell I think you missed something :P You can't do session.socket.destroy() because it'll throw ERR_HTTP2_NO_SOCKET_MANIPULATION, but you can do session.socket.ref().destroy(). As I said, these functions expose the original socket: session.socket.ref()
session.socket.unref()
session.socket.setEncoding()
session.socket.setKeepAlive()
session.socket.setNoDelay()So ProxySocket should look like: get(session, prop) {
switch (prop) {
case 'setTimeout':
return session.setTimeout.bind(session);
case 'destroy':
case 'emit':
case 'end':
case 'pause':
case 'read':
case 'resume':
case 'write':
case 'setEncoding':
case 'setKeepAlive':
case 'setNoDelay':
throw new ERR_HTTP2_NO_SOCKET_MANIPULATION();
case 'ref':
case 'unref':
return socket[prop].bind(session.socket);
default:
const socket = session[kSocket];
if (socket === undefined)
throw new ERR_HTTP2_SOCKET_UNBOUND();
const value = socket[prop];
return typeof value === 'function' ? value.bind(socket) : value;
}
}
...
set(session, prop, value) {
switch (prop) {
case 'setTimeout':
session.setTimeout = value;
return true;
case 'destroy':
case 'emit':
case 'end':
case 'pause':
case 'read':
case 'resume':
case 'write':
case 'setEncoding':
case 'setKeepAlive':
case 'setNoDelay':
case 'ref':
case 'unref':
throw new ERR_HTTP2_NO_SOCKET_MANIPULATION();
default:
const socket = session[kSocket];
if (socket === undefined)
throw new ERR_HTTP2_SOCKET_UNBOUND();
socket[prop] = value;
return true;
} |
Sorry, something went wrong.
|
@szmarczak good spot! would you like to open a PR to fix that? |
Sorry, something went wrong.
|
Yeah, sure. |
Sorry, something went wrong.
Sorry, something went wrong.
Fixes: nodejs#22268 PR-URL: nodejs#22486 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Refs: nodejs#22486 PR-URL: nodejs#22650 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Fixes: nodejs#22268 PR-URL: nodejs#22486 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Refs: nodejs#22486 PR-URL: nodejs#22650 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com>
| Back | FazBrowse Home | New Git URL |
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