From de56ffa58b08d69e428fa221681ef305464898a8 Mon Sep 17 00:00:00 2001 From: Timothy J Fontaine Date: Mon, 24 Feb 2014 18:38:41 -0800 Subject: [PATCH] test: pummel/*ci-reneg* handle EPIPE When calling out to the openssl client handle the child closing and returning EPIPE on writes --- test/pummel/test-https-ci-reneg-attack.js | 16 +++++++++++++--- test/pummel/test-tls-ci-reneg-attack.js | 16 +++++++++++++--- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/test/pummel/test-https-ci-reneg-attack.js b/test/pummel/test-https-ci-reneg-attack.js index 4b9f32eff5..2dacfc065b 100644 --- a/test/pummel/test-https-ci-reneg-attack.js +++ b/test/pummel/test-https-ci-reneg-attack.js @@ -67,8 +67,11 @@ function test(next) { var args = ('s_client -connect 127.0.0.1:' + common.PORT).split(' '); var child = spawn(common.opensslCli, args); - child.stdout.pipe(process.stdout); - child.stderr.pipe(process.stderr); + //child.stdout.pipe(process.stdout); + //child.stderr.pipe(process.stderr); + + child.stdout.resume(); + child.stderr.resume(); // count handshakes, start the attack after the initial handshake is done var handshakes = 0; @@ -89,7 +92,14 @@ function test(next) { var closed = false; child.stdin.on('error', function(err) { - assert.equal(err.code, 'ECONNRESET'); + switch (err.code) { + case 'ECONNRESET': + case 'EPIPE': + break; + default: + assert.equal(err.code, 'ECONNRESET'); + break; + } closed = true; }); child.stdin.on('close', function() { diff --git a/test/pummel/test-tls-ci-reneg-attack.js b/test/pummel/test-tls-ci-reneg-attack.js index 020abcbfa0..13c3fe1095 100644 --- a/test/pummel/test-tls-ci-reneg-attack.js +++ b/test/pummel/test-tls-ci-reneg-attack.js @@ -65,8 +65,11 @@ function test(next) { var args = ('s_client -connect 127.0.0.1:' + common.PORT).split(' '); var child = spawn(common.opensslCli, args); - child.stdout.pipe(process.stdout); - child.stderr.pipe(process.stderr); + //child.stdout.pipe(process.stdout); + //child.stderr.pipe(process.stderr); + + child.stdout.resume(); + child.stderr.resume(); // count handshakes, start the attack after the initial handshake is done var handshakes = 0; @@ -87,7 +90,14 @@ function test(next) { var closed = false; child.stdin.on('error', function(err) { - assert.equal(err.code, 'ECONNRESET'); + switch (err.code) { + case 'ECONNRESET': + case 'EPIPE': + break; + default: + assert.equal(err.code, 'ECONNRESET'); + break; + } closed = true; }); child.stdin.on('close', function() {