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

Loading…
Cancel
Save