1*1b3c3ba0Sbluhm# test chunked http connection over http relay invoking the callback 2*1b3c3ba0Sbluhm# The client writes a bad chunk length in the second chunk. 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/3 HTTP/1.1 15*1b3c3ba0SbluhmHost: foo.bar 16*1b3c3ba0SbluhmTransfer-Encoding: chunked 17*1b3c3ba0Sbluhm 18*1b3c3ba0Sbluhm4 19*1b3c3ba0Sbluhm123 20*1b3c3ba0Sbluhm 21*1b3c3ba0SbluhmXXX 22*1b3c3ba0Sbluhm3 23*1b3c3ba0Sbluhm12 24*1b3c3ba0Sbluhm 25*1b3c3ba0Sbluhm0 26*1b3c3ba0Sbluhm 27*1b3c3ba0SbluhmEOF 28*1b3c3ba0Sbluhm print STDERR "LEN: 4\n"; 29*1b3c3ba0Sbluhm print STDERR "LEN: 3\n"; 30*1b3c3ba0Sbluhm # relayd does not forward the first chunk if the second one 31*1b3c3ba0Sbluhm # is invalid. So do not expect any response. 32*1b3c3ba0Sbluhm #http_response($self, "without len"); 33*1b3c3ba0Sbluhm }, 34*1b3c3ba0Sbluhm http_vers => ["1.1"], 35*1b3c3ba0Sbluhm lengths => \@lengths, 36*1b3c3ba0Sbluhm method => "PUT", 37*1b3c3ba0Sbluhm }, 38*1b3c3ba0Sbluhm relayd => { 39*1b3c3ba0Sbluhm protocol => [ "http", 40*1b3c3ba0Sbluhm "match request header log foo", 41*1b3c3ba0Sbluhm "match response header log bar", 42*1b3c3ba0Sbluhm ], 43*1b3c3ba0Sbluhm loggrep => { 44*1b3c3ba0Sbluhm qr/, invalid chunk size, PUT/ => 1, 45*1b3c3ba0Sbluhm }, 46*1b3c3ba0Sbluhm }, 47*1b3c3ba0Sbluhm server => { 48*1b3c3ba0Sbluhm func => \&http_server, 49*1b3c3ba0Sbluhm nocheck => 1, 50*1b3c3ba0Sbluhm }, 51*1b3c3ba0Sbluhm lengths => \@lengths, 52*1b3c3ba0Sbluhm); 53*1b3c3ba0Sbluhm 54*1b3c3ba0Sbluhm1; 55