|
|
@ -343,22 +343,6 @@ util.inherits(OutgoingMessage, stream.Stream); |
|
|
|
exports.OutgoingMessage = OutgoingMessage; |
|
|
|
|
|
|
|
|
|
|
|
OutgoingMessage.prototype.assignSocket = function(socket) { |
|
|
|
assert(!socket._httpMessage); |
|
|
|
socket._httpMessage = this; |
|
|
|
this.socket = socket; |
|
|
|
this.connection = socket; |
|
|
|
this._flush(); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
OutgoingMessage.prototype.detachSocket = function(socket) { |
|
|
|
assert(socket._httpMessage == this); |
|
|
|
socket._httpMessage = null; |
|
|
|
this.socket = this.connection = null; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
OutgoingMessage.prototype.destroy = function(error) { |
|
|
|
this.socket.destroy(error); |
|
|
|
}; |
|
|
@ -792,6 +776,26 @@ exports.ServerResponse = ServerResponse; |
|
|
|
|
|
|
|
ServerResponse.prototype.statusCode = 200; |
|
|
|
|
|
|
|
function onServerResponseClose() { |
|
|
|
this._httpMessage.emit('close'); |
|
|
|
} |
|
|
|
|
|
|
|
ServerResponse.prototype.assignSocket = function(socket) { |
|
|
|
assert(!socket._httpMessage); |
|
|
|
socket._httpMessage = this; |
|
|
|
socket.on('close', onServerResponseClose); |
|
|
|
this.socket = socket; |
|
|
|
this.connection = socket; |
|
|
|
this._flush(); |
|
|
|
}; |
|
|
|
|
|
|
|
ServerResponse.prototype.detachSocket = function(socket) { |
|
|
|
assert(socket._httpMessage == this); |
|
|
|
socket.removeListener('close', onServerResponseClose); |
|
|
|
socket._httpMessage = null; |
|
|
|
this.socket = this.connection = null; |
|
|
|
}; |
|
|
|
|
|
|
|
ServerResponse.prototype.writeContinue = function() { |
|
|
|
this._writeRaw('HTTP/1.1 100 Continue' + CRLF + CRLF, 'ascii'); |
|
|
|
this._sent100 = true; |
|
|
|