Browse Source

Forgot to include fix from HTTP client bug (30b0522)

v0.7.4-release
Ryan Dahl 15 years ago
parent
commit
1bb52947e0
  1. 9
      lib/http.js

9
lib/http.js

@ -418,6 +418,7 @@ exports.createClient = function (port, host) {
var secure_credentials={ secure : false }; var secure_credentials={ secure : false };
var requests = []; var requests = [];
var currentRequest;
client._pushRequest = function (req) { client._pushRequest = function (req) {
req.addListener("flush", function () { req.addListener("flush", function () {
@ -434,7 +435,7 @@ exports.createClient = function (port, host) {
return; return;
} }
//sys.debug("client flush readyState = " + client.readyState); //sys.debug("client flush readyState = " + client.readyState);
if (req == requests[0]) flushMessageQueue(client, [req]); if (req == currentRequest) flushMessageQueue(client, [req]);
}); });
requests.push(req); requests.push(req);
}; };
@ -451,7 +452,8 @@ exports.createClient = function (port, host) {
client.addListener("connect", function () { client.addListener("connect", function () {
client.resetParser(); client.resetParser();
requests[0].flush(); currentRequest = requests.shift();
currentRequest.flush();
}); });
client.addListener("eof", function () { client.addListener("eof", function () {
@ -489,8 +491,7 @@ exports.createClient = function (port, host) {
client.close(); client.close();
}); });
var req = requests.shift(); currentRequest.emit("response", res);
req.emit("response", res);
}); });
return client; return client;

Loading…
Cancel
Save