http: fix "Cannot call method 'emit' of null"
authorBen Noordhuis <info@bnoordhuis.nl>
Mon, 14 Jan 2013 15:35:03 +0000 (16:35 +0100)
committerBen Noordhuis <info@bnoordhuis.nl>
Mon, 14 Jan 2013 16:28:32 +0000 (17:28 +0100)
commitf3e78bd3c21028dfd96efed7ae2654ceff1e7878
tree5a9aa9d102b95ae583ebd5eeb0364faf09419146
parent4c9de9d7169a4f0365ec1c754cdbb3f7d22fef45
http: fix "Cannot call method 'emit' of null"

Fix the following exception:

  http.js:974
    this._httpMessage.emit('close');
                      ^
  TypeError: Cannot call method 'emit' of null
      at Socket.onServerResponseClose (http.js:974:21)
      at Socket.EventEmitter.emit (events.js:124:20)
      at net.js:421:10
      at process._tickCallback (node.js:386:13)
      at process._makeCallback (node.js:304:15)

Fixes #4586.
lib/http.js
test/simple/test-http-server-stale-close.js [new file with mode: 0644]