summaryrefslogtreecommitdiff
path: root/regress/usr.sbin/relayd/args-https-chunked-callback.pl
blob: a4fe57a33b95818e17cc1caed189b34baeae7d3b (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# test chunked https connection over http relay invoking the callback
# The client writes a bad chunk length in the second chunk.
# Check that the relay handles the input after the error correctly.

use strict;
use warnings;

my @lengths = ([4, 3]);
our %args = (
    client => {
	func => sub {
	    my $self = shift;
	    print <<'EOF';
PUT /4/3 HTTP/1.1
Host: foo.bar
Transfer-Encoding: chunked

4
123

XXX
3
12

0

EOF
	    print STDERR "LEN: 4\n";
	    print STDERR "LEN: 3\n";
	    # relayd does not forward the first chunk if the second one
	    # is invalid.  So do not expect any response.
	    #http_response($self, "without len");
	},
	ssl => 1,
	http_vers => ["1.1"],
	lengths => \@lengths,
	method => "PUT",
    },
    relayd => {
	protocol => [ "http",
	    "match request header log foo",
	    "match response header log bar",
	],
	forwardssl => 1,
	listenssl => 1,
	loggrep => {
	    qr/, invalid chunk size, PUT/ => 1,
	},
    },
    server => {
	func => \&http_server,
	# relayd only connects but does no ssl handshake
	#ssl => 1,
	nocheck => 1,
    },
    lengths => \@lengths,
);

1;