1# test chunked http connection over http relay invoking the callback
2# The client writes a bad chunk length in the second chunk.
3# Check that the relay handles the input after the error correctly.
4
5use strict;
6use warnings;
7
8my @lengths = ([4, 3]);
9our %args = (
10    client => {
11	func => sub {
12	    my $self = shift;
13	    print <<'EOF';
14PUT /4/3 HTTP/1.1
15Host: foo.bar
16Transfer-Encoding: chunked
17
184
19123
20
21XXX
223
2312
24
250
26
27EOF
28	    print STDERR "LEN: 4\n";
29	    print STDERR "LEN: 3\n";
30	    # relayd does not forward the first chunk if the second one
31	    # is invalid.  So do not expect any response.
32	    #http_response($self, "without len");
33	},
34	http_vers => ["1.1"],
35	lengths => \@lengths,
36	method => "PUT",
37    },
38    relayd => {
39	protocol => [ "http",
40	    "match request header log foo",
41	    "match response header log bar",
42	],
43	loggrep => {
44	    qr/, invalid chunk size, PUT/ => 1,
45	},
46    },
47    server => {
48	func => \&http_server,
49	nocheck => 1,
50    },
51    lengths => \@lengths,
52);
53
541;
55