Response write/end to noop() when request aborted #724

Merged
merged 1 commit into from May 21, 2013

Conversation

Projects
None yet
3 participants
Contributor

ZJONSSON commented Jan 11, 2013

Had problems with compress module when the request are aborted by the client:

Error: Cannot write after end at Gzip.write (zlib.js:307:31) at ServerResponse.module.exports.res.write (c:\program files\nodejs\node_mo ules\connect\lib\middleware\compress.js:81:18)

I'm not sure if this is the most efficient fix, but pointing res.write and res.end to noop() eliminates the error.

Just faced the same problem.

Contributor

ZJONSSON commented May 20, 2013

@skaapgif did you try my fix posted above. You can simply add it manually to your request object:

 // Remove response write/end if request aborted
req.on("close",function() {
  res.write = res.end = function() {}
});

tj added a commit that referenced this pull request May 21, 2013

Merge pull request #724 from ZJONSSON/compress_aborted
Response write/end to noop() when request aborted

@tj tj merged commit 2b9c4e7 into senchalabs:master May 21, 2013

1 check failed

default The Travis build failed
Details
Member

tj commented May 21, 2013

probably would be best if we did some .finished bool check or something in there but this should work for now

Contributor

ZJONSSON commented May 21, 2013

Thanks, yes exactly!

@ZJONSSON ZJONSSON deleted the ZJONSSON:compress_aborted branch May 21, 2013

@Fishrock123 Fishrock123 referenced this pull request in expressjs/compression Apr 27, 2014

Closed

Response write/end to noop() when request aborted #8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment