summaryrefslogtreecommitdiff
path: root/regress/usr.sbin
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2011-09-04 12:19:45 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2011-09-04 12:19:45 +0000
commit2dcbd260f262e8301295751051756a2acfa48e4a (patch)
treea26f76bf8c10feb6c477d03dbb937dbaaee55f02 /regress/usr.sbin
parentc14c4bde64c3a25fb9e36737d9a969a8781889ed (diff)
Add test wether relayd is logging the correct http content-length.
Diffstat (limited to 'regress/usr.sbin')
-rw-r--r--regress/usr.sbin/relayd/args-http-contentlength.pl25
-rw-r--r--regress/usr.sbin/relayd/relayd.pl12
2 files changed, 36 insertions, 1 deletions
diff --git a/regress/usr.sbin/relayd/args-http-contentlength.pl b/regress/usr.sbin/relayd/args-http-contentlength.pl
new file mode 100644
index 00000000000..fc36cd96556
--- /dev/null
+++ b/regress/usr.sbin/relayd/args-http-contentlength.pl
@@ -0,0 +1,25 @@
+# test persistent http 1.1 connection and grep for content length
+
+use strict;
+use warnings;
+
+my @lengths = (1, 2, 0, 3, 4);
+our %args = (
+ client => {
+ func => \&http_client,
+ lengths => \@lengths,
+ },
+ relayd => {
+ protocol => [ "http",
+ "request header log foo",
+ "response header log Content-Length",
+ ],
+ loggrep => [ map { "log 'Content-Length: $_'" } @lengths ],
+ },
+ server => {
+ func => \&http_server,
+ },
+ lengths => \@lengths,
+);
+
+1;
diff --git a/regress/usr.sbin/relayd/relayd.pl b/regress/usr.sbin/relayd/relayd.pl
index 878fdbb865a..d458204838c 100644
--- a/regress/usr.sbin/relayd/relayd.pl
+++ b/regress/usr.sbin/relayd/relayd.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $OpenBSD: relayd.pl,v 1.3 2011/09/02 21:05:41 bluhm Exp $
+# $OpenBSD: relayd.pl,v 1.4 2011/09/04 12:19:44 bluhm Exp $
# Copyright (c) 2010,2011 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -75,6 +75,16 @@ $c->down;
$s->down;
$r->down;
+foreach ([ client => $c ], [ relayd => $r ], [ server => $s ]) {
+ my($name, $proc) = @$_;
+ my $pattern = $args{$name}{loggrep} or next;
+ $pattern = [ $pattern ] unless ref($pattern) eq 'ARRAY';
+ foreach my $pat (@$pattern) {
+ $proc->loggrep($pat)
+ or die "$name log missing pattern: $pat";
+ }
+}
+
exit if $args{nocheck};
my @clen = $c->loggrep(qr/^LEN: /) or die "no client len"