1# test persistent http connection over http relay invoking the callback
2# The client writes a bad header line in the second request.
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 HTTP/1.1
15Host: foo.bar
16Content-Length: 4
17
18123
19PUT /3 HTTP/1.1
20XXX
21Host: foo.bar
22Content-Length: 3
23
2412
25EOF
26	    print STDERR "LEN: 4\n";
27	    print STDERR "LEN: 3\n";
28	    # relayd does not forward the first request if the second one
29	    # is invalid.  So do not expect any response.
30	    #http_response($self, "without len");
31	},
32	http_vers => ["1.1"],
33	lengths => \@lengths,
34	method => "PUT",
35    },
36    relayd => {
37	protocol => [ "http",
38	    "match request header log foo",
39	    "match response header log bar",
40	],
41	loggrep => {
42	    qr/, malformed, PUT/ => 1,
43	},
44    },
45    server => {
46	func => \&http_server,
47	# The server does not get any connection.
48	noserver => 1,
49	nocheck => 1,
50    },
51    lengths => \@lengths,
52);
53
541;
55