joyent/node — pull request #7132 by alFReD-NSH (2014-02-16 16:22:48+00:00)
Title: http: Improve HTTP Expect header handling

Just following the spec:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.20

Fixes #4651

Note that, Now we have the following pattern 3 times in the _http_server.js:

```
if (EventEmitter.listenerCount(self, 'someEventName') > 0) {
self.emit('someEventName');
} else {
// Do something as default
}
```

I think maybe we should move it to a function, though didn't have any good idea for the name of the function. Something like this. If you guys give me a good name, I'll refactor it.

I also see this pattern in userland too. Maybe it should be a event emitter prototype method name `setDefaultListener` that will set the default action.