Skip to content

Commit 1eec5f0

Browse files
committed
http: simplify code and remove unused properties
PR-URL: #1572 Reviewed-By: Chris Dickinson <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
1 parent ba76a9d commit 1eec5f0

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

lib/_http_common.js

-6
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,6 @@ function parserOnMessageComplete() {
126126
parser._url = '';
127127
}
128128

129-
if (!stream.upgrade)
130-
// For upgraded connections, also emit this after parser.execute
131-
stream.push(null);
132-
}
133-
134-
if (stream && !parser.incoming._pendings.length) {
135129
// For emit end event
136130
stream.push(null);
137131
}

lib/_http_incoming.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ function IncomingMessage(socket) {
3838

3939
this.readable = true;
4040

41-
this._pendings = [];
42-
this._pendingIndex = 0;
4341
this.upgrade = null;
4442

4543
// request (server) only
@@ -49,7 +47,7 @@ function IncomingMessage(socket) {
4947
// response (client) only
5048
this.statusCode = null;
5149
this.statusMessage = null;
52-
this.client = this.socket;
50+
this._client = socket; // deprecated
5351

5452
// flag for backwards compatibility grossness.
5553
this._consuming = false;
@@ -63,6 +61,16 @@ util.inherits(IncomingMessage, Stream.Readable);
6361

6462
exports.IncomingMessage = IncomingMessage;
6563

64+
Object.defineProperty(IncomingMessage.prototype, 'client', {
65+
configurable: true,
66+
enumerable: true,
67+
get: util.deprecate(function() {
68+
return this._client;
69+
}, 'client is deprecated, use socket or connection instead'),
70+
set: util.deprecate(function(val) {
71+
this._client = val;
72+
}, 'client is deprecated, use socket or connection instead')
73+
});
6674

6775
IncomingMessage.prototype.setTimeout = function(msecs, callback) {
6876
if (callback)

lib/_http_outgoing.js

-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ function OutgoingMessage() {
6262
this._trailer = '';
6363

6464
this.finished = false;
65-
this._hangupClose = false;
6665
this._headerSent = false;
6766

6867
this.socket = null;

0 commit comments

Comments
 (0)