A HTTP connection may have multiple requests with content. Allow
authorbluhm <bluhm@openbsd.org>
Sun, 20 Jul 2014 19:18:31 +0000 (19:18 +0000)
committerbluhm <bluhm@openbsd.org>
Sun, 20 Jul 2014 19:18:31 +0000 (19:18 +0000)
to specify an array of md5 hashes in the test arguments and check
all of them in the client and server log files.  So test that relayd
does not modify the http body.

regress/usr.sbin/relayd/args-http-chunked.pl
regress/usr.sbin/relayd/args-http-contentlength.pl
regress/usr.sbin/relayd/args-http-filter-persistent.pl
regress/usr.sbin/relayd/args-http-persistent.pl
regress/usr.sbin/relayd/args-http-put.pl
regress/usr.sbin/relayd/args-https-chunked.pl
regress/usr.sbin/relayd/args-https-contentlength.pl
regress/usr.sbin/relayd/args-https-filter-persistent.pl
regress/usr.sbin/relayd/args-https-persistent.pl
regress/usr.sbin/relayd/args-https-put.pl
regress/usr.sbin/relayd/funcs.pl

index a6f13bb..e3fa98e 100644 (file)
@@ -24,7 +24,14 @@ our %args = (
        func => \&http_server,
     },
     lengths => \@lengths,
-    md5 => "bc3a3f39af35fe5b1687903da2b00c7f",
+    md5 => [
+       "bc3a3f39af35fe5b1687903da2b00c7f",
+       "fccd8d69acceb0cc35f2fd4e2f6938d3",
+       "c47658d102d5b989e0da09ce403f7463",
+       "68b329da9893e34099c7d8ad5cb9c940",
+       "897316929176464ebc9ad085f31e7284",
+       "0ade138937c4b9cb36a28e2edb6485fc",
+    ],
 );
 
 1;
index 0ec36d4..2362af4 100644 (file)
@@ -20,6 +20,18 @@ our %args = (
        func => \&http_server,
     },
     lengths => \@lengths,
+    md5 => [
+       "68b329da9893e34099c7d8ad5cb9c940",
+       "897316929176464ebc9ad085f31e7284",
+       "d41d8cd98f00b204e9800998ecf8427e",
+       "0ade138937c4b9cb36a28e2edb6485fc",
+       "e686f5db1f8610b65f98f3718e1a5b72",
+       "68b329da9893e34099c7d8ad5cb9c940",
+       "897316929176464ebc9ad085f31e7284",
+       "d41d8cd98f00b204e9800998ecf8427e",
+       "0ade138937c4b9cb36a28e2edb6485fc",
+       "e686f5db1f8610b65f98f3718e1a5b72",
+    ],
 );
 
 1;
index 3a8cfdb..fe03666 100644 (file)
@@ -20,7 +20,22 @@ our %args = (
        func => \&http_server,
     },
     lengths => [251, 16384, 0, 1, 3, 4, 5],
-    md5 => "bc3a3f39af35fe5b1687903da2b00c7f",
+    md5 => [
+       "bc3a3f39af35fe5b1687903da2b00c7f",
+       "52afece07e61264c3087ddf52f729376",
+       "d41d8cd98f00b204e9800998ecf8427e",
+       "68b329da9893e34099c7d8ad5cb9c940",
+       "0ade138937c4b9cb36a28e2edb6485fc",
+       "e686f5db1f8610b65f98f3718e1a5b72",
+       "e5870c1091c20ed693976546d23b4841",
+       "bc3a3f39af35fe5b1687903da2b00c7f",
+       "52afece07e61264c3087ddf52f729376",
+       "d41d8cd98f00b204e9800998ecf8427e",
+       "68b329da9893e34099c7d8ad5cb9c940",
+       "0ade138937c4b9cb36a28e2edb6485fc",
+       "e686f5db1f8610b65f98f3718e1a5b72",
+       "e5870c1091c20ed693976546d23b4841",
+    ],
 );
 
 1;
index bb2279f..b9e052b 100644 (file)
@@ -22,7 +22,24 @@ our %args = (
        func => \&http_server,
     },
     lengths => \@lengths,
-    md5 => "bc3a3f39af35fe5b1687903da2b00c7f",
+    md5 => [
+       "bc3a3f39af35fe5b1687903da2b00c7f",
+       "52afece07e61264c3087ddf52f729376",
+       "d41d8cd98f00b204e9800998ecf8427e",
+       "68b329da9893e34099c7d8ad5cb9c940",
+       "897316929176464ebc9ad085f31e7284",
+       "0ade138937c4b9cb36a28e2edb6485fc",
+       "e686f5db1f8610b65f98f3718e1a5b72",
+       "e5870c1091c20ed693976546d23b4841",
+       "bc3a3f39af35fe5b1687903da2b00c7f",
+       "52afece07e61264c3087ddf52f729376",
+       "d41d8cd98f00b204e9800998ecf8427e",
+       "68b329da9893e34099c7d8ad5cb9c940",
+       "897316929176464ebc9ad085f31e7284",
+       "0ade138937c4b9cb36a28e2edb6485fc",
+       "e686f5db1f8610b65f98f3718e1a5b72",
+       "e5870c1091c20ed693976546d23b4841",
+    ],
 );
 
 1;
index 39abc85..5fa727d 100644 (file)
@@ -23,7 +23,24 @@ our %args = (
        func => \&http_server,
     },
     lengths => \@lengths,
-    md5 => "bc3a3f39af35fe5b1687903da2b00c7f",
+    md5 => [
+       "bc3a3f39af35fe5b1687903da2b00c7f",
+       "52afece07e61264c3087ddf52f729376",
+       "d41d8cd98f00b204e9800998ecf8427e",
+       "68b329da9893e34099c7d8ad5cb9c940",
+       "897316929176464ebc9ad085f31e7284",
+       "0ade138937c4b9cb36a28e2edb6485fc",
+       "e686f5db1f8610b65f98f3718e1a5b72",
+       "e5870c1091c20ed693976546d23b4841",
+       "bc3a3f39af35fe5b1687903da2b00c7f",
+       "52afece07e61264c3087ddf52f729376",
+       "d41d8cd98f00b204e9800998ecf8427e",
+       "68b329da9893e34099c7d8ad5cb9c940",
+       "897316929176464ebc9ad085f31e7284",
+       "0ade138937c4b9cb36a28e2edb6485fc",
+       "e686f5db1f8610b65f98f3718e1a5b72",
+       "e5870c1091c20ed693976546d23b4841",
+    ],
 );
 
 1;
index eaf506d..0a62174 100644 (file)
@@ -28,7 +28,14 @@ our %args = (
        ssl => 1,
     },
     lengths => \@lengths,
-    md5 => "bc3a3f39af35fe5b1687903da2b00c7f",
+    md5 => [
+       "bc3a3f39af35fe5b1687903da2b00c7f",
+       "fccd8d69acceb0cc35f2fd4e2f6938d3",
+       "c47658d102d5b989e0da09ce403f7463",
+       "68b329da9893e34099c7d8ad5cb9c940",
+       "897316929176464ebc9ad085f31e7284",
+       "0ade138937c4b9cb36a28e2edb6485fc",
+    ],
 );
 
 1;
index 80f6787..227d255 100644 (file)
@@ -24,6 +24,18 @@ our %args = (
        ssl => 1,
     },
     lengths => \@lengths,
+    md5 => [
+       "68b329da9893e34099c7d8ad5cb9c940",
+       "897316929176464ebc9ad085f31e7284",
+       "d41d8cd98f00b204e9800998ecf8427e",
+       "0ade138937c4b9cb36a28e2edb6485fc",
+       "e686f5db1f8610b65f98f3718e1a5b72",
+       "68b329da9893e34099c7d8ad5cb9c940",
+       "897316929176464ebc9ad085f31e7284",
+       "d41d8cd98f00b204e9800998ecf8427e",
+       "0ade138937c4b9cb36a28e2edb6485fc",
+       "e686f5db1f8610b65f98f3718e1a5b72",
+    ],
 );
 
 1;
index 61dde49..8e3b5b5 100644 (file)
@@ -27,7 +27,22 @@ our %args = (
        ssl => 1,
     },
     lengths => [251, 16384, 0, 1, 3, 4, 5],
-    md5 => "bc3a3f39af35fe5b1687903da2b00c7f",
+    md5 => [
+       "bc3a3f39af35fe5b1687903da2b00c7f",
+       "52afece07e61264c3087ddf52f729376",
+       "d41d8cd98f00b204e9800998ecf8427e",
+       "68b329da9893e34099c7d8ad5cb9c940",
+       "0ade138937c4b9cb36a28e2edb6485fc",
+       "e686f5db1f8610b65f98f3718e1a5b72",
+       "e5870c1091c20ed693976546d23b4841",
+       "bc3a3f39af35fe5b1687903da2b00c7f",
+       "52afece07e61264c3087ddf52f729376",
+       "d41d8cd98f00b204e9800998ecf8427e",
+       "68b329da9893e34099c7d8ad5cb9c940",
+       "0ade138937c4b9cb36a28e2edb6485fc",
+       "e686f5db1f8610b65f98f3718e1a5b72",
+       "e5870c1091c20ed693976546d23b4841",
+    ],
 );
 
 1;
index f6ba0f5..30e690d 100644 (file)
@@ -26,7 +26,24 @@ our %args = (
        ssl => 1,
     },
     lengths => \@lengths,
-    md5 => "bc3a3f39af35fe5b1687903da2b00c7f",
+    md5 => [
+       "bc3a3f39af35fe5b1687903da2b00c7f",
+       "52afece07e61264c3087ddf52f729376",
+       "d41d8cd98f00b204e9800998ecf8427e",
+       "68b329da9893e34099c7d8ad5cb9c940",
+       "897316929176464ebc9ad085f31e7284",
+       "0ade138937c4b9cb36a28e2edb6485fc",
+       "e686f5db1f8610b65f98f3718e1a5b72",
+       "e5870c1091c20ed693976546d23b4841",
+       "bc3a3f39af35fe5b1687903da2b00c7f",
+       "52afece07e61264c3087ddf52f729376",
+       "d41d8cd98f00b204e9800998ecf8427e",
+       "68b329da9893e34099c7d8ad5cb9c940",
+       "897316929176464ebc9ad085f31e7284",
+       "0ade138937c4b9cb36a28e2edb6485fc",
+       "e686f5db1f8610b65f98f3718e1a5b72",
+       "e5870c1091c20ed693976546d23b4841",
+    ],
 );
 
 1;
index 9ea50cb..e0f87f1 100644 (file)
@@ -27,7 +27,24 @@ our %args = (
        ssl => 1,
     },
     lengths => \@lengths,
-    md5 => "bc3a3f39af35fe5b1687903da2b00c7f",
+    md5 => [
+       "bc3a3f39af35fe5b1687903da2b00c7f",
+       "52afece07e61264c3087ddf52f729376",
+       "d41d8cd98f00b204e9800998ecf8427e",
+       "68b329da9893e34099c7d8ad5cb9c940",
+       "897316929176464ebc9ad085f31e7284",
+       "0ade138937c4b9cb36a28e2edb6485fc",
+       "e686f5db1f8610b65f98f3718e1a5b72",
+       "e5870c1091c20ed693976546d23b4841",
+       "bc3a3f39af35fe5b1687903da2b00c7f",
+       "52afece07e61264c3087ddf52f729376",
+       "d41d8cd98f00b204e9800998ecf8427e",
+       "68b329da9893e34099c7d8ad5cb9c940",
+       "897316929176464ebc9ad085f31e7284",
+       "0ade138937c4b9cb36a28e2edb6485fc",
+       "e686f5db1f8610b65f98f3718e1a5b72",
+       "e5870c1091c20ed693976546d23b4841",
+    ],
 );
 
 1;
index 4c729b1..8954eb7 100644 (file)
@@ -1,4 +1,4 @@
-#      $OpenBSD: funcs.pl,v 1.15 2014/07/10 19:42:59 bluhm Exp $
+#      $OpenBSD: funcs.pl,v 1.16 2014/07/20 19:18:32 bluhm Exp $
 
 # Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org>
 #
@@ -407,16 +407,31 @@ sub check_len {
 sub check_md5 {
        my ($c, $r, $s, %args) = @_;
 
-       my $cmd5 = $c->loggrep(qr/^MD5: /) unless $args{client}{nocheck};
-       my $smd5 = $s->loggrep(qr/^MD5: /) unless $args{server}{nocheck};
-       !$cmd5 || !$smd5 || ref($args{md5}) eq 'ARRAY' || $cmd5 eq $smd5
-           or die "client: $cmd5", "server: $smd5", "md5 mismatch";
-       my $md5 = ref($args{md5}) eq 'ARRAY' ?
-           join('|', @{$args{md5}}) : $args{md5};
-       !$md5 || !$cmd5 || $cmd5 =~ /^MD5: ($md5)$/
-           or die "client: $cmd5", "md5 $md5 expected";
-       !$md5 || !$smd5 || $smd5 =~ /^MD5: ($md5)$/
-           or die "server: $smd5", "md5 $md5 expected";
+       my @cmd5 = $c->loggrep(qr/^MD5: /) unless $args{client}{nocheck};
+       my @smd5 = $s->loggrep(qr/^MD5: /) unless $args{server}{nocheck};
+       !@cmd5 || !@smd5 || $cmd5[0] eq $smd5[0]
+           or die "client: $cmd5[0]", "server: $smd5[0]", "md5 mismatch";
+
+       my @md5 = ref($args{md5}) eq 'ARRAY' ? @{$args{md5}} : $args{md5} || ()
+           or return;
+       foreach my $md5 (@md5) {
+               unless ($args{client}{nocheck}) {
+                       my $cmd5 = shift @cmd5
+                           or die "too few md5 in client log";
+                       $cmd5 =~ /^MD5: ($md5)$/
+                           or die "client: $cmd5", "md5 $md5 expected";
+               }
+               unless ($args{server}{nocheck}) {
+                       my $smd5 = shift @smd5
+                           or die "too few md5 in server log";
+                       $smd5 =~ /^MD5: ($md5)$/
+                           or die "server: $smd5", "md5 $md5 expected";
+               }
+       }
+       @cmd5 && ref($args{md5}) eq 'ARRAY'
+           and die "too many md5 in client log";
+       @smd5 && ref($args{md5}) eq 'ARRAY'
+           and die "too many md5 in server log";
 }
 
 sub check_loggrep {