joepie91 / node-bhttp

A sane HTTP client library for Node.js with Streams2 support.
62 stars 12 forks source link

responseTimeout timer is not cleared on request error #39

Open antishok opened 5 years ago

antishok commented 5 years ago

If you set a responseTimeout on a request, and then, before the responseTimeout has elapsed, the request has an error (e.g. connection timeout), then the responseTimeout timer is not cleared. This can cause issues like a hanging process, or memory leaks.

I believe it just needs adding a clearTimeout in the req.on("error") handler