Skip to content

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

Open
official-burak wants to merge 1 commit into
forwardemail:masterfrom
official-burak:fix/max-response-size-double-callback
Open

fix: report maxResponseSize overflow without a double callback#1852
official-burak wants to merge 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

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.
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

1 participant