Fix for unhandled gunzip/zlib errors #528
This commit is contained in:
parent
6193f58dd2
commit
8a76df8884
@ -115,16 +115,16 @@ function handleCopyFrom (logger) {
|
|||||||
|
|
||||||
req
|
req
|
||||||
.on('data', data => isGzip ? metrics.addGzipSize(data.length) : undefined)
|
.on('data', data => isGzip ? metrics.addGzipSize(data.length) : undefined)
|
||||||
.on('error', err => {
|
|
||||||
metrics.end(null, err);
|
|
||||||
pgstream.emit('error', err);
|
|
||||||
})
|
|
||||||
.on('close', () => {
|
.on('close', () => {
|
||||||
const err = new Error('Connection closed by client');
|
const err = new Error('Connection closed by client');
|
||||||
pgstream.emit('cancelQuery', err);
|
pgstream.emit('cancelQuery', err);
|
||||||
pgstream.emit('error', err);
|
pgstream.emit('error', err);
|
||||||
})
|
})
|
||||||
.pipe(isGzip ? zlib.createGunzip() : new PassThrough())
|
.pipe(isGzip ? zlib.createGunzip() : new PassThrough())
|
||||||
|
.on('error', err => {
|
||||||
|
metrics.end(null, err);
|
||||||
|
pgstream.emit('error', err);
|
||||||
|
})
|
||||||
.on('data', data => {
|
.on('data', data => {
|
||||||
metrics.addSize(data.length);
|
metrics.addSize(data.length);
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ describe('copy-endpoints', function() {
|
|||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
JSON.parse(res.body),
|
JSON.parse(res.body),
|
||||||
{
|
{
|
||||||
error:["Error while decompressing: incorrect header check"]
|
error:["incorrect header check"]
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
|
Loading…
Reference in New Issue
Block a user