1*1b3c3ba0Sbluhm# test https connection over http relay invoking the callback.
2*1b3c3ba0Sbluhm# The client uses a bad method in the second request.
3*1b3c3ba0Sbluhm# Check that the relay handles the input after the error correctly.
4*1b3c3ba0Sbluhm
5*1b3c3ba0Sbluhmuse strict;
6*1b3c3ba0Sbluhmuse warnings;
7*1b3c3ba0Sbluhm
8*1b3c3ba0Sbluhmmy @lengths = (4, 3);
9*1b3c3ba0Sbluhmour %args = (
10*1b3c3ba0Sbluhm    client => {
11*1b3c3ba0Sbluhm	func => sub {
12*1b3c3ba0Sbluhm	    my $self = shift;
13*1b3c3ba0Sbluhm	    print <<'EOF';
14*1b3c3ba0SbluhmPUT /4 HTTP/1.1
15*1b3c3ba0SbluhmHost: foo.bar
16*1b3c3ba0SbluhmContent-Length: 4
17*1b3c3ba0Sbluhm
18*1b3c3ba0Sbluhm123
19*1b3c3ba0SbluhmXXX
20*1b3c3ba0SbluhmPUT /3 HTTP/1.1
21*1b3c3ba0SbluhmHost: foo.bar
22*1b3c3ba0SbluhmContent-Length: 3
23*1b3c3ba0Sbluhm
24*1b3c3ba0Sbluhm12
25*1b3c3ba0SbluhmEOF
26*1b3c3ba0Sbluhm	    print STDERR "LEN: 4\n";
27*1b3c3ba0Sbluhm	    print STDERR "LEN: 3\n";
28*1b3c3ba0Sbluhm	    # relayd does not forward the first request if the second one
29*1b3c3ba0Sbluhm	    # is invalid.  So do not expect any response.
30*1b3c3ba0Sbluhm	    #http_response($self, "without len");
31*1b3c3ba0Sbluhm	},
32*1b3c3ba0Sbluhm	ssl => 1,
33*1b3c3ba0Sbluhm	http_vers => ["1.1"],
34*1b3c3ba0Sbluhm	lengths => \@lengths,
35*1b3c3ba0Sbluhm	method => "PUT",
36*1b3c3ba0Sbluhm    },
37*1b3c3ba0Sbluhm    relayd => {
38*1b3c3ba0Sbluhm	protocol => [ "http",
39*1b3c3ba0Sbluhm	    "match request header log foo",
40*1b3c3ba0Sbluhm	    "match response header log bar",
41*1b3c3ba0Sbluhm	],
42*1b3c3ba0Sbluhm	forwardssl => 1,
43*1b3c3ba0Sbluhm	listenssl => 1,
44*1b3c3ba0Sbluhm	loggrep => {
45*1b3c3ba0Sbluhm	    qr/, malformed, PUT/ => 1,
46*1b3c3ba0Sbluhm	},
47*1b3c3ba0Sbluhm    },
48*1b3c3ba0Sbluhm    server => {
49*1b3c3ba0Sbluhm	func => \&http_server,
50*1b3c3ba0Sbluhm	ssl => 1,
51*1b3c3ba0Sbluhm	# The server does not get any connection.
52*1b3c3ba0Sbluhm	noserver => 1,
53*1b3c3ba0Sbluhm	nocheck => 1,
54*1b3c3ba0Sbluhm    },
55*1b3c3ba0Sbluhm    lengths => \@lengths,
56*1b3c3ba0Sbluhm);
57*1b3c3ba0Sbluhm
58*1b3c3ba0Sbluhm1;
59