summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2014-07-20 19:18:33 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2014-07-20 19:18:33 +0000
commit55d9a8c864489197269c0b93e088626a891f1363 (patch)
tree67d38c596eef52ef59cd95cbab690cbd09e408b1
parent43d3dd96046841a03db84fa287262e4e4a010207 (diff)
A HTTP connection may have multiple requests with content. Allow
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.
-rw-r--r--regress/usr.sbin/relayd/args-http-chunked.pl9
-rw-r--r--regress/usr.sbin/relayd/args-http-contentlength.pl12
-rw-r--r--regress/usr.sbin/relayd/args-http-filter-persistent.pl17
-rw-r--r--regress/usr.sbin/relayd/args-http-persistent.pl19
-rw-r--r--regress/usr.sbin/relayd/args-http-put.pl19
-rw-r--r--regress/usr.sbin/relayd/args-https-chunked.pl9
-rw-r--r--regress/usr.sbin/relayd/args-https-contentlength.pl12
-rw-r--r--regress/usr.sbin/relayd/args-https-filter-persistent.pl17
-rw-r--r--regress/usr.sbin/relayd/args-https-persistent.pl19
-rw-r--r--regress/usr.sbin/relayd/args-https-put.pl19
-rw-r--r--regress/usr.sbin/relayd/funcs.pl37
11 files changed, 170 insertions, 19 deletions
diff --git a/regress/usr.sbin/relayd/args-http-chunked.pl b/regress/usr.sbin/relayd/args-http-chunked.pl
index a6f13bb4e91..e3fa98e5817 100644
--- a/regress/usr.sbin/relayd/args-http-chunked.pl
+++ b/regress/usr.sbin/relayd/args-http-chunked.pl
@@ -24,7 +24,14 @@ our %args = (
func => \&http_server,
},
lengths => \@lengths,
- md5 => "bc3a3f39af35fe5b1687903da2b00c7f",
+ md5 => [
+ "bc3a3f39af35fe5b1687903da2b00c7f",
+ "fccd8d69acceb0cc35f2fd4e2f6938d3",
+ "c47658d102d5b989e0da09ce403f7463",
+ "68b329da9893e34099c7d8ad5cb9c940",
+ "897316929176464ebc9ad085f31e7284",
+ "0ade138937c4b9cb36a28e2edb6485fc",
+ ],
);
1;
diff --git a/regress/usr.sbin/relayd/args-http-contentlength.pl b/regress/usr.sbin/relayd/args-http-contentlength.pl
index 0ec36d47b8d..2362af457c5 100644
--- a/regress/usr.sbin/relayd/args-http-contentlength.pl
+++ b/regress/usr.sbin/relayd/args-http-contentlength.pl
@@ -20,6 +20,18 @@ our %args = (
func => \&http_server,
},
lengths => \@lengths,
+ md5 => [
+ "68b329da9893e34099c7d8ad5cb9c940",
+ "897316929176464ebc9ad085f31e7284",
+ "d41d8cd98f00b204e9800998ecf8427e",
+ "0ade138937c4b9cb36a28e2edb6485fc",
+ "e686f5db1f8610b65f98f3718e1a5b72",
+ "68b329da9893e34099c7d8ad5cb9c940",
+ "897316929176464ebc9ad085f31e7284",
+ "d41d8cd98f00b204e9800998ecf8427e",
+ "0ade138937c4b9cb36a28e2edb6485fc",
+ "e686f5db1f8610b65f98f3718e1a5b72",
+ ],
);
1;
diff --git a/regress/usr.sbin/relayd/args-http-filter-persistent.pl b/regress/usr.sbin/relayd/args-http-filter-persistent.pl
index 3a8cfdba99b..fe03666de89 100644
--- a/regress/usr.sbin/relayd/args-http-filter-persistent.pl
+++ b/regress/usr.sbin/relayd/args-http-filter-persistent.pl
@@ -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;
diff --git a/regress/usr.sbin/relayd/args-http-persistent.pl b/regress/usr.sbin/relayd/args-http-persistent.pl
index bb2279f205b..b9e052b8c99 100644
--- a/regress/usr.sbin/relayd/args-http-persistent.pl
+++ b/regress/usr.sbin/relayd/args-http-persistent.pl
@@ -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;
diff --git a/regress/usr.sbin/relayd/args-http-put.pl b/regress/usr.sbin/relayd/args-http-put.pl
index 39abc8579a0..5fa727db7f5 100644
--- a/regress/usr.sbin/relayd/args-http-put.pl
+++ b/regress/usr.sbin/relayd/args-http-put.pl
@@ -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;
diff --git a/regress/usr.sbin/relayd/args-https-chunked.pl b/regress/usr.sbin/relayd/args-https-chunked.pl
index eaf506df71e..0a62174e2cb 100644
--- a/regress/usr.sbin/relayd/args-https-chunked.pl
+++ b/regress/usr.sbin/relayd/args-https-chunked.pl
@@ -28,7 +28,14 @@ our %args = (
ssl => 1,
},
lengths => \@lengths,
- md5 => "bc3a3f39af35fe5b1687903da2b00c7f",
+ md5 => [
+ "bc3a3f39af35fe5b1687903da2b00c7f",
+ "fccd8d69acceb0cc35f2fd4e2f6938d3",
+ "c47658d102d5b989e0da09ce403f7463",
+ "68b329da9893e34099c7d8ad5cb9c940",
+ "897316929176464ebc9ad085f31e7284",
+ "0ade138937c4b9cb36a28e2edb6485fc",
+ ],
);
1;
diff --git a/regress/usr.sbin/relayd/args-https-contentlength.pl b/regress/usr.sbin/relayd/args-https-contentlength.pl
index 80f6787e5d8..227d255da8f 100644
--- a/regress/usr.sbin/relayd/args-https-contentlength.pl
+++ b/regress/usr.sbin/relayd/args-https-contentlength.pl
@@ -24,6 +24,18 @@ our %args = (
ssl => 1,
},
lengths => \@lengths,
+ md5 => [
+ "68b329da9893e34099c7d8ad5cb9c940",
+ "897316929176464ebc9ad085f31e7284",
+ "d41d8cd98f00b204e9800998ecf8427e",
+ "0ade138937c4b9cb36a28e2edb6485fc",
+ "e686f5db1f8610b65f98f3718e1a5b72",
+ "68b329da9893e34099c7d8ad5cb9c940",
+ "897316929176464ebc9ad085f31e7284",
+ "d41d8cd98f00b204e9800998ecf8427e",
+ "0ade138937c4b9cb36a28e2edb6485fc",
+ "e686f5db1f8610b65f98f3718e1a5b72",
+ ],
);
1;
diff --git a/regress/usr.sbin/relayd/args-https-filter-persistent.pl b/regress/usr.sbin/relayd/args-https-filter-persistent.pl
index 61dde49c834..8e3b5b5432f 100644
--- a/regress/usr.sbin/relayd/args-https-filter-persistent.pl
+++ b/regress/usr.sbin/relayd/args-https-filter-persistent.pl
@@ -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;
diff --git a/regress/usr.sbin/relayd/args-https-persistent.pl b/regress/usr.sbin/relayd/args-https-persistent.pl
index f6ba0f54dcb..30e690dae96 100644
--- a/regress/usr.sbin/relayd/args-https-persistent.pl
+++ b/regress/usr.sbin/relayd/args-https-persistent.pl
@@ -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;
diff --git a/regress/usr.sbin/relayd/args-https-put.pl b/regress/usr.sbin/relayd/args-https-put.pl
index 9ea50cbab5a..e0f87f12ab3 100644
--- a/regress/usr.sbin/relayd/args-https-put.pl
+++ b/regress/usr.sbin/relayd/args-https-put.pl
@@ -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;
diff --git a/regress/usr.sbin/relayd/funcs.pl b/regress/usr.sbin/relayd/funcs.pl
index 4c729b1afac..8954eb7050f 100644
--- a/regress/usr.sbin/relayd/funcs.pl
+++ b/regress/usr.sbin/relayd/funcs.pl
@@ -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 {