joyent/node — Issue #2570: Problem with ServerResponse emitting close - http server crashes
Author: Kami
Created: 2012-01-18 08:05:06+00:00
State: open

When I hit an http server with curl it crashes with the following exception:

```
Uncaught TypeError: Cannot call method 'emit' of null
at Socket.onServerResponseClose (http.js:780:21)
at Socket.emit (events.js:88:20)
at Array. (net.js:320:10)
at EventEmitter._tickCallback (node.js:192:40)
----------------------------------------
at EventEmitter.on
at ServerResponse.assignSocket (http.js:786:10)
at HTTPParser.onIncoming (http.js:1454:11)
at HTTPParser.onHeadersComplete (http.js:102:31)
at Socket.ondata (http.js:1387:22)
at TCP.onread (net.js:354:27)
Uncaught undefined

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
```

It seems to be related to commit e5627e2ad15ca7273812f55bca6283d5eafb9244. If I revert this commit, the server doesn't crashes.

My first impression was that it has something to do with how the curl closes the connection, but so far I haven't been able to create an isolated test case yet which reproduces it.

I will dig deeper into it tomorrow and try to come up with a test case which reproduces it.