http: simplify code and remove unused properties
authorBrian White <mscdex@mscdex.net>
Sat, 2 May 2015 01:37:05 +0000 (21:37 -0400)
committerBrian White <mscdex@mscdex.net>
Mon, 25 May 2015 05:07:22 +0000 (01:07 -0400)
PR-URL: https://github.com/nodejs/io.js/pull/1572
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
lib/_http_common.js
lib/_http_incoming.js
lib/_http_outgoing.js

index 7861848..7570329 100644 (file)
@@ -126,12 +126,6 @@ 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);
   }
index b371c7d..295a3ef 100644 (file)
@@ -38,8 +38,6 @@ function IncomingMessage(socket) {
 
   this.readable = true;
 
-  this._pendings = [];
-  this._pendingIndex = 0;
   this.upgrade = null;
 
   // request (server) only
@@ -49,7 +47,7 @@ function IncomingMessage(socket) {
   // response (client) only
   this.statusCode = null;
   this.statusMessage = null;
-  this.client = this.socket;
+  this._client = socket; // deprecated
 
   // flag for backwards compatibility grossness.
   this._consuming = false;
@@ -63,6 +61,16 @@ 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)
index 9726ca9..6ebf716 100644 (file)
@@ -62,7 +62,6 @@ function OutgoingMessage() {
   this._trailer = '';
 
   this.finished = false;
-  this._hangupClose = false;
   this._headerSent = false;
 
   this.socket = null;