summaryrefslogtreecommitdiff
path: root/regress/usr.sbin/relayd/args-http-mark-marked2.pl
blob: 234c8af114e27bf27d1a2e4853ac774f71cae1b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# match and set header with tags

use strict;
use warnings;

my %header_client = (
    "User-Agent" => "Mozilla Bla",
    "MyHeader" => "UnmatchableContent",
);

our %args = (
    client => {
	func => \&http_client,
	header => \%header_client,
	len => 33,
    },
    relayd => {
	protocol => [ "http",
	    # setting the User-Agent should succeed
	    'match request header "User-Agent" value "Mozilla*" tag BORK',
	    'match request header set "User-Agent" value "BORK" tagged BORK',
	    'match request header log "User-Agent"',
	    # setting MyHeader should not happen
	    'match request header "MyHeader" value "SomethingDifferent" tag FOO',
	    'match request header set "MyHeader" value "FOO" tagged FOO',
	    'match request header log "MyHeader"',
	],
	loggrep => {
	    'User-Agent: BORK' => 1,
	    'MyHeader: FOO' => 0,
	},
    },
    server => {
	func => \&http_server,
	loggrep => {
	    "User-Agent: BORK" => 1,
	    "MyHeader: FOO" => 0,
	}
    },
    len => 33,
);

1;