Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "http: simplify code and remove unused properties" #1851

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/_http_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ function parserOnMessageComplete() {
parser._url = '';
}

if (!stream.upgrade)
// For upgraded connections, also emit this after parser.execute
stream.push(null);
}

if (stream && !parser.incoming._pendings.length) {
// For emit end event
stream.push(null);
}
Expand Down
14 changes: 3 additions & 11 deletions lib/_http_incoming.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ function IncomingMessage(socket) {

this.readable = true;

this._pendings = [];
this._pendingIndex = 0;
this.upgrade = null;

// request (server) only
Expand All @@ -47,7 +49,7 @@ function IncomingMessage(socket) {
// response (client) only
this.statusCode = null;
this.statusMessage = null;
this._client = socket; // deprecated
this.client = this.socket;

// flag for backwards compatibility grossness.
this._consuming = false;
Expand All @@ -61,16 +63,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)
Expand Down
1 change: 1 addition & 0 deletions lib/_http_outgoing.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function OutgoingMessage() {
this._trailer = '';

this.finished = false;
this._hangupClose = false;
this._headerSent = false;

this.socket = null;
Expand Down