Double 'error' Events on HTTPS Requests #2549

russellhaering opened this Issue Jan 16, 2012 · 4 comments


None yet

3 participants


There is a bug introduced in 0.6.7 (specifically, by 07c27e0) that causes double 'error' events to be emitted by https requests where the connection is refused.

Test case:

What seems to happen is that the socket error is propagated up to the http layer, which responds by trying to destroy the ClearTextStream. As of the commit referenced above, when destroy is called on the SecurePair, if the connection has not been established it emits an error. This logic seems broken. I'm not sure, but I think the best approach is to do one of two things:

  1. Not rely on SecurePair.prototype.destroy to emit errors
  2. Track whether an error has been emitted so we don't double emit errors
@koichik koichik added a commit to koichik/node that referenced this issue Jan 17, 2012
@koichik koichik tls: fix double 'error' events on HTTPS Requests
Fixes #2549.
koichik commented Jan 17, 2012

Can someone review koichik/node@fcdf2d0?


@koichik: fcdf2d0 LGTM. Thanks for the quick fix.

koichik commented Jan 17, 2012

@bnoordhuis - Thanks for your review, merging.

@koichik koichik closed this in 534df2f Jan 17, 2012
koichik commented Jan 17, 2012

@russellhaering - Thanks for the report, fixed in 534df2f.

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