args-http-contentlength-get.pl revision 1.1
1# Test to verify that relayd strips Content-Length and body 2# from GET requests. 3 4use strict; 5use warnings; 6 7my $payload_len = 64; 8our %args = ( 9 client => { 10 func => sub { 11 my $self = shift; 12 my @request_stream = split("\n", <<"EOF", -1); 13GET http://foo.bar/$payload_len HTTP/1.1 14Content-Length: $payload_len 15 16foo=bar 17 18EOF 19 pop @request_stream; 20 print map { "$_\r\n" } @request_stream; 21 print STDERR map { ">>> $_\n" } @request_stream; 22 $self->{method} = 'GET'; 23 http_response($self, $payload_len); 24 }, 25 loggrep => { 26 qr/Content-Length: $payload_len/ => 2, 27 qr/foo=bar/ => 1, 28 }, 29 http_vers => ["1.1"], 30 nocheck => 1, 31 }, 32 relayd => { 33 protocol => [ "http", 34 "match request path log \"*\"", 35 ], 36 loggrep => { 37 qr/, done, \[http:\/\/foo.bar\/$payload_len\] GET/ => 1, 38 }, 39 }, 40 server => { 41 func => \&http_server, 42 loggrep => { 43 qr/Content-Length: $payload_len/ => 1, 44 qr/foo=bar/ => 0, 45 }, 46 nocheck => 1, 47 }, 48); 49 501; 51