Skip to content

fix: report maxResponseSize overflow without a double callback - #1852

Merged
titanism merged 1 commit into
forwardemail:masterfrom
official-burak:fix/max-response-size-double-callback
Sep 22, 2026
Merged

titanism merged 1 commit into
forwardemail:masterfrom
official-burak:fix/max-response-size-double-callback

Conversation

@official-burak

@official-burak official-burak commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Hitting maxResponseSize called callback() and then res.destroy(error). Node emits error on destroy, and the body parser also fails, so callback() ran again and printed superagent: double callback bug.
  • Destroy the response without an error after the ETOOLARGE callback, and ignore later parser completion once this.called is set.
  • Regression coverage for image responses and the gzip zip-bomb path.

Fixes #1830

Test plan

  • mocha test/node/image.js test/node/inflate.js (HTTP/1 and HTTP/2)
  • Full Node HTTP/1 suite: 362 passing
  • CI on this PR

IncomingMessage.destroy(err) emits error, and the body parser also
fails, so each path called callback() again after ETOOLARGE.
@codecov-commenter

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@titanism
titanism merged commit 632b5a0 into forwardemail:master Sep 22, 2026
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fix] "superagent: double callback bug" with maxResponseSize

3 participants