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
18EOF
19	    ${$self->{server}}->up;
20	    print <<'EOF';
214
22123
23
24XXX
253
2612
27
280
29
30EOF
31	    print STDERR "LEN: 4\n";
32	    print STDERR "LEN: 3\n";
33	    # relayd does not forward the first chunk if the second one
34	    # is invalid.  So do not expect any response.
35	    #http_response($self, "without len");
36	},
37	http_vers => ["1.1"],
38	lengths => \@lengths,
39	method => "PUT",
40    },
41    relayd => {
42	protocol => [ "http",
43	    "match request header log foo",
44	    "match response header log bar",
45	],
46	loggrep => {
47	    qr/, invalid chunk size, PUT/ => 1,
48	},
49    },
50    server => {
51	down => "Server missing chunk size",
52	func => sub { errignore(@_); http_server(@_); },
53	nocheck => 1,
54    },
55    lengths => \@lengths,
56);
57
581;
59