summaryrefslogtreecommitdiff
path: root/regress/usr.sbin/relayd
diff options
context:
space:
mode:
Diffstat (limited to 'regress/usr.sbin/relayd')
-rw-r--r--regress/usr.sbin/relayd/args-http-change-cookie.pl27
-rw-r--r--regress/usr.sbin/relayd/funcs.pl22
2 files changed, 46 insertions, 3 deletions
diff --git a/regress/usr.sbin/relayd/args-http-change-cookie.pl b/regress/usr.sbin/relayd/args-http-change-cookie.pl
new file mode 100644
index 00000000000..ac0dd71c83f
--- /dev/null
+++ b/regress/usr.sbin/relayd/args-http-change-cookie.pl
@@ -0,0 +1,27 @@
+use strict;
+use warnings;
+
+my $name = "X-Set-Cookie";
+my %header = ("$name" => [ "test=a;", "test=b;" ]);
+our %args = (
+ client => {
+ func => \&http_client,
+ loggrep => {
+ qr/$name: test=c/ => 1,
+ }
+ },
+ relayd => {
+ protocol => [ "http",
+ 'match response header set "'.$name.'" value "test=c"',
+ ],
+ },
+ server => {
+ func => \&http_server,
+ header => \%header,
+ loggrep => {
+ qr/$name: test=a/ => 1
+ },
+ },
+);
+
+1;
diff --git a/regress/usr.sbin/relayd/funcs.pl b/regress/usr.sbin/relayd/funcs.pl
index bb0256af641..5ab7d5279f3 100644
--- a/regress/usr.sbin/relayd/funcs.pl
+++ b/regress/usr.sbin/relayd/funcs.pl
@@ -1,4 +1,4 @@
-# $OpenBSD: funcs.pl,v 1.13 2014/07/10 10:19:06 bluhm Exp $
+# $OpenBSD: funcs.pl,v 1.14 2014/07/10 11:56:11 reyk Exp $
# Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -139,7 +139,15 @@ sub http_request {
push @request, "Content-Length: $len"
if $vers eq "1.1" && $method eq "PUT" &&
!defined $header{'Content-Length'};
- push @request, "$_: $header{$_}" foreach sort keys %header;
+ foreach my $key (sort keys %header) {
+ my $val = $header{$key};
+ if (ref($val) eq 'ARRAY') {
+ push @request, "$key: $_"
+ foreach @{$val};
+ } else {
+ push @request, "$key: $val";
+ }
+ }
push @request, "Cookie: $cookie" if $cookie;
push @request, "";
print STDERR map { ">>> $_\n" } @request;
@@ -306,7 +314,15 @@ sub http_server {
push @response, "Content-Length: $len"
if $vers eq "1.1" && $method eq "GET";
}
- push @response, "$_: $header{$_} " foreach sort keys %header;
+ foreach my $key (sort keys %header) {
+ my $val = $header{$key};
+ if (ref($val) eq 'ARRAY') {
+ push @response, "$key: $_"
+ foreach @{$val};
+ } else {
+ push @response, "$key: $val";
+ }
+ }
push @response, "Set-Cookie: $cookie" if $cookie;
push @response, "";