fixed timing problem that lead to lost request bodies
This commit is contained in:
parent
68d6322b42
commit
528e58969e
|
@ -50,7 +50,7 @@ module.exports.create = function (deps, config) {
|
|||
}
|
||||
|
||||
console.warn('failed to identify protocol from first chunk', firstChunk);
|
||||
conn.close();
|
||||
conn.destroy();
|
||||
}
|
||||
function netHandler(conn, opts) {
|
||||
function getProp(name) {
|
||||
|
|
|
@ -29,12 +29,14 @@ module.exports.create = function (deps, conf, greenlockMiddleware) {
|
|||
function handleChunk(chunk) {
|
||||
if (!errored) {
|
||||
opts.firstChunk = Buffer.concat([opts.firstChunk, chunk]);
|
||||
if (opts.firstChunk.includes('\r\n\r\n')) {
|
||||
resolve(opts.firstChunk.toString());
|
||||
conn.removeListener('error', handleErr);
|
||||
} else {
|
||||
if (!opts.firstChunk.includes('\r\n\r\n')) {
|
||||
conn.once('data', handleChunk);
|
||||
return;
|
||||
}
|
||||
|
||||
conn.removeListener('error', handleErr);
|
||||
conn.pause();
|
||||
resolve(opts.firstChunk.toString());
|
||||
}
|
||||
}
|
||||
conn.once('data', handleChunk);
|
||||
|
@ -144,6 +146,7 @@ module.exports.create = function (deps, conf, greenlockMiddleware) {
|
|||
// data comes in.
|
||||
process.nextTick(function () {
|
||||
conn.unshift(opts.firstChunk);
|
||||
conn.resume();
|
||||
});
|
||||
|
||||
// Convenience return for all the check* functions.
|
||||
|
@ -160,6 +163,7 @@ module.exports.create = function (deps, conf, greenlockMiddleware) {
|
|||
deps.tunnelServer.handleClientConn(conn);
|
||||
process.nextTick(function () {
|
||||
conn.unshift(opts.firstChunk);
|
||||
conn.resume();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
@ -211,6 +215,7 @@ module.exports.create = function (deps, conf, greenlockMiddleware) {
|
|||
deps.tunnelServer.handleAdminConn(conn);
|
||||
process.nextTick(function () {
|
||||
conn.unshift(opts.firstChunk);
|
||||
conn.resume();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue