-
Notifications
You must be signed in to change notification settings - Fork 729
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
Handle connectivity issues while reading the body #1343
Conversation
It looks like there is a problem with Node v14, looking into it. |
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.
Left a small comment, but otherwise looks good to me
cleanListeners() | ||
this._openRequests-- | ||
request.once('error', () => {}) // we need to catch the request aborted error | ||
request.abort() |
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.
If you use request.destroy()
it might solve the v14 problem and it will also not emit an error event so you will no longer need the empty error handler.
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 for the review! I'm looking into this, as request.abort
has been deprecated in newer versions of node.
Very likely I'll address this in a separate pr while working on #1297.
Thanks to the awesome Node.js contributors I've discovered the |
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-7.x 7.x
# Navigate to the new working tree
cd .worktrees/backport-7.x
# Create a new branch
git switch --create backport-1343-to-7.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick ---mainline 1 edd4f78badb47b96120d60e36f0c0f16dd7584e6
# Push it to GitHub
git push --set-upstream origin backport-1343-to-7.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-7.x Then, create a pull request where the |
lib/Transport.js
Outdated
@@ -237,9 +237,9 @@ class Transport { | |||
if (isCompressed) { | |||
payload = Buffer.concat(payload) | |||
} | |||
if (result.headers['content-length'] !== undefined && Number(result.headers['content-length']) !== payload.length) { | |||
if (result.headers['content-length'] !== undefined && Number(result.headers['content-length']) !== Buffer.byteLength(payload)) { |
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.
That´s why everyone loves javascript 👯♀️
hi, possible to back port this fix on 5.x ? |
Until now the client was not verifying the
content-length
header, this pr address this issue.For supporting this, the unzip process has been moved from the
Connection
class to theTransport
class.A byproduct of this pr is the fix of #1088.
Closes: #1088
/cc: @msisti @tomsquest