test: pummel/*ci-reneg* handle EPIPE
authorTimothy J Fontaine <tjfontaine@gmail.com>
Tue, 25 Feb 2014 02:38:41 +0000 (18:38 -0800)
committerTimothy J Fontaine <tjfontaine@gmail.com>
Tue, 25 Feb 2014 02:38:41 +0000 (18:38 -0800)
When calling out to the openssl client handle the child closing and
returning EPIPE on writes

test/pummel/test-https-ci-reneg-attack.js
test/pummel/test-tls-ci-reneg-attack.js

index 4b9f32e..2dacfc0 100644 (file)
@@ -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() {
index 020abcb..13c3fe1 100644 (file)
@@ -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() {