From 26547fe093a0cfb3131c5eaa1c64c041e0a31f32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sun, 31 May 2015 13:25:27 +0200 Subject: [PATCH] http: revert deprecation of client property Reason: breaks a feature in the request module --- lib/_http_incoming.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/_http_incoming.js b/lib/_http_incoming.js index 295a3ef4bd257b..ffebb0ba82c2d7 100644 --- a/lib/_http_incoming.js +++ b/lib/_http_incoming.js @@ -15,6 +15,16 @@ function readStop(socket) { } exports.readStop = readStop; +const deprecatedClientProperty = { + configurable: true, + enumerable: true, + get: util.deprecate(function() { + return this.socket; + }, 'client is deprecated, use socket instead'), + set: util.deprecate(function(val) { + this.socket = val; + }, 'client is deprecated, use socket instead') +}; /* Abstract base class for ServerRequest and ClientResponse. */ function IncomingMessage(socket) { @@ -47,7 +57,7 @@ function IncomingMessage(socket) { // response (client) only this.statusCode = null; this.statusMessage = null; - this._client = socket; // deprecated + Object.defineProperty(this, 'client', deprecatedClientProperty); // flag for backwards compatibility grossness. this._consuming = false; @@ -61,16 +71,6 @@ util.inherits(IncomingMessage, Stream.Readable); exports.IncomingMessage = IncomingMessage; -Object.defineProperty(IncomingMessage.prototype, 'client', { - configurable: true, - enumerable: true, - get: util.deprecate(function() { - return this._client; - }, 'client is deprecated, use socket or connection instead'), - set: util.deprecate(function(val) { - this._client = val; - }, 'client is deprecated, use socket or connection instead') -}); IncomingMessage.prototype.setTimeout = function(msecs, callback) { if (callback)