http: Don't switch the socket into old-mode
This commit is contained in:
parent
bc8feb151c
commit
9ece63b1d7
18
lib/http.js
18
lib/http.js
@ -35,6 +35,16 @@ if (process.env.NODE_DEBUG && /http/.test(process.env.NODE_DEBUG)) {
|
|||||||
debug = function() { };
|
debug = function() { };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function readStart(socket) {
|
||||||
|
if (!socket || !socket._handle || !socket._handle.readStart) return;
|
||||||
|
socket._handle.readStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
function readStop(socket) {
|
||||||
|
if (!socket || !socket._handle || !socket._handle.readStop) return;
|
||||||
|
socket._handle.readStop();
|
||||||
|
}
|
||||||
|
|
||||||
// Only called in the slow case where slow means
|
// Only called in the slow case where slow means
|
||||||
// that the request headers were either fragmented
|
// that the request headers were either fragmented
|
||||||
// across multiple TCP packets or too large to be
|
// across multiple TCP packets or too large to be
|
||||||
@ -129,7 +139,7 @@ function parserOnBody(b, start, len) {
|
|||||||
var slice = b.slice(start, start + len);
|
var slice = b.slice(start, start + len);
|
||||||
var ret = stream.push(slice);
|
var ret = stream.push(slice);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
socket.pause();
|
readStop(socket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +173,7 @@ function parserOnMessageComplete() {
|
|||||||
|
|
||||||
if (parser.socket.readable) {
|
if (parser.socket.readable) {
|
||||||
// force to read the next incoming message
|
// force to read the next incoming message
|
||||||
parser.socket.resume();
|
readStart(parser.socket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,7 +335,7 @@ IncomingMessage.prototype._read = function(n, callback) {
|
|||||||
if (!this.socket.readable)
|
if (!this.socket.readable)
|
||||||
return callback(null, null);
|
return callback(null, null);
|
||||||
else
|
else
|
||||||
this.socket.resume();
|
readStart(this.socket);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -399,7 +409,7 @@ IncomingMessage.prototype._dump = function() {
|
|||||||
this._dumped = true;
|
this._dumped = true;
|
||||||
this.socket.parser.incoming = null;
|
this.socket.parser.incoming = null;
|
||||||
this.push(null);
|
this.push(null);
|
||||||
this.socket.resume();
|
readStart(this.socket);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user