Skip to content
Myr

Remove socket error handler if file was sent successfully.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Ruben Verborgh · committed by Ruben Verborgh · parent 07b6c9f · Browse files · 1 file+8 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−2 removed

  • other:+8 added−2 removed

1 file+8 added−2 removed

modified:lib/response.js+8 added-2 removed
188 unmodified lines
189 if (done) return;190 done = true;191192 // clean up193 req.socket.removeListener('error', error);193 cleanup();194 if (!self.headerSent) self.removeHeader('Content-Disposition');195196 // callback available197 if (fn) return fn(err);
7 unmodified lines
205206 // streaming207 function stream() {208 if (done) return;209 req.socket.removeListener('error', error);209 cleanup();210 if (fn) self.on('finish', fn);211 }212213 // cleanup214 function cleanup() {215 req.socket.removeListener('error', error);216 }217218 // transfer219 var file = send(req, path);220 if (options.root) file.root(options.root);221 file.maxage(options.maxAge || 0);222 file.on('error', error);223 file.on('directory', next);224 file.on('stream', stream);225 file.pipe(this);226 this.on('finish', cleanup);227};228229/**230 * Transfer the file at the given `path` as an attachment.
373 unmodified lines