Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Revert "http: make http.ServerResponse emit 'end'"
Browse files Browse the repository at this point in the history
This reverts commit 790d651.

This makes Duplex streams unworkable, and would only ever be a special
case for HTTP responses, which is not ideal.

Intead, we're going to just bless the 'finish' event for all Writable
streams in 0.10
  • Loading branch information
isaacs committed Oct 4, 2012
1 parent 016afe2 commit 836a06f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 72 deletions.
11 changes: 0 additions & 11 deletions doc/api/http.markdown
Expand Up @@ -321,17 +321,6 @@ passed as the second parameter to the `'request'` event.
The response implements the [Writable Stream][] interface. This is an
[EventEmitter][] with the following events:

### Event: 'end'

`function () { }`

Emitted when the response has been sent. More specifically, this event is
emitted when the last segment of the response headers and body have been
handed off to the operating system for transmission over the network. It
does not imply that the client has received anything yet.

After this event, no more events will be emitted on the response object.

### Event: 'close'

`function () { }`
Expand Down
4 changes: 2 additions & 2 deletions lib/http.js
Expand Up @@ -840,7 +840,7 @@ OutgoingMessage.prototype._finish = function() {
assert(this instanceof ClientRequest);
DTRACE_HTTP_CLIENT_REQUEST(this, this.connection);
}
this.emit('end');
this.emit('finish');
};


Expand Down Expand Up @@ -1780,7 +1780,7 @@ function connectionListener(socket) {

// When we're finished writing the response, check if this is the last
// respose, if so destroy the socket.
res.on('end', function() {
res.on('finish', function() {
// Usually the first incoming element should be our request. it may
// be that in the case abortIncoming() was called that the incoming
// array will be empty.
Expand Down
59 changes: 0 additions & 59 deletions test/simple/test-http-response-end.js

This file was deleted.

0 comments on commit 836a06f

Please sign in to comment.