summaryrefslogtreecommitdiff
path: root/regress/usr.sbin/relayd/args-http-head-get.pl
blob: 3176d05e33f87fb98cb6f56497938e1e231c1e7b (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
44
45
use strict;
use warnings;

my $payload_len = 64;
our %args = (
    client => {
	func => sub {
	    my $self = shift;
	    my @request_stream = split("\n", <<"EOF", -1);
HEAD http://foo.bar/$payload_len HTTP/1.1

EOF
	    pop @request_stream;
	    print map { "$_\r\n" } @request_stream;
	    print STDERR map { ">>> $_\n" } @request_stream;
	    $self->{method} = 'HEAD';
	    http_response($self, $payload_len);
	    @request_stream = split("\n", <<"EOF", -1);
GET http://foo.bar/$payload_len HTTP/1.1

EOF
	    pop @request_stream;
	    print map { "$_\r\n" } @request_stream;
	    print STDERR map { ">>> $_\n" } @request_stream;
	    $self->{method} = 'GET';
	    http_response($self, $payload_len);
	},
	http_vers => ["1.1"],
	nocheck => 1,
    },
    relayd => {
	protocol => [ "http",
	    "match request path log \"*\"",
	],
	loggrep => {
	    qr/, done, \[http:\/\/foo.bar\/$payload_len\] HEAD; \[http:\/\/foo.bar\/$payload_len\] GET/ => 1,
	},
    },
    server => {
	func => \&http_server,
	nocheck => 1,
    },
);

1;