summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/tests/certs/server-cert.pem21
-rw-r--r--plugins/tests/certs/server-key.pem15
-rwxr-xr-xplugins/tests/check_http.t322
3 files changed, 230 insertions, 128 deletions
diff --git a/plugins/tests/certs/server-cert.pem b/plugins/tests/certs/server-cert.pem
new file mode 100644
index 0000000..549e4f7
--- /dev/null
+++ b/plugins/tests/certs/server-cert.pem
@@ -0,0 +1,21 @@
1-----BEGIN CERTIFICATE-----
2MIIDYzCCAsygAwIBAgIJAL8LkpNwzYdxMA0GCSqGSIb3DQEBBAUAMH8xCzAJBgNV
3BAYTAlVLMRMwEQYDVQQIEwpEZXJieXNoaXJlMQ8wDQYDVQQHEwZCZWxwZXIxFzAV
4BgNVBAoTDk5hZ2lvcyBQbHVnaW5zMREwDwYDVQQDEwhUb24gVm9vbjEeMBwGCSqG
5SIb3DQEJARYPdG9udm9vbkBtYWMuY29tMB4XDTA5MDMwNTIxNDEyOFoXDTE5MDMw
6MzIxNDEyOFowfzELMAkGA1UEBhMCVUsxEzARBgNVBAgTCkRlcmJ5c2hpcmUxDzAN
7BgNVBAcTBkJlbHBlcjEXMBUGA1UEChMOTmFnaW9zIFBsdWdpbnMxETAPBgNVBAMT
8CFRvbiBWb29uMR4wHAYJKoZIhvcNAQkBFg90b252b29uQG1hYy5jb20wgZ8wDQYJ
9KoZIhvcNAQEBBQADgY0AMIGJAoGBAKcWMBtNtfY8vZXk0SN6/EYTVN/LOvaOSegy
10oVdLoGwuwjagk+XmCzvCqHZRp8lnCLay7AO8AQI7TSN02ihCcSrgGA9OT+HciIJ1
11l5/kEYUAuA1PR6YKK/T713zUAlMzy2tsugx5+xSsSEwsXkmne52jJiG/wuE5CLT0
129pF8HQqHAgMBAAGjgeYwgeMwHQYDVR0OBBYEFGioSPQ/rdE19+zaeY2YvHTXlUDI
13MIGzBgNVHSMEgaswgaiAFGioSPQ/rdE19+zaeY2YvHTXlUDIoYGEpIGBMH8xCzAJ
14BgNVBAYTAlVLMRMwEQYDVQQIEwpEZXJieXNoaXJlMQ8wDQYDVQQHEwZCZWxwZXIx
15FzAVBgNVBAoTDk5hZ2lvcyBQbHVnaW5zMREwDwYDVQQDEwhUb24gVm9vbjEeMBwG
16CSqGSIb3DQEJARYPdG9udm9vbkBtYWMuY29tggkAvwuSk3DNh3EwDAYDVR0TBAUw
17AwEB/zANBgkqhkiG9w0BAQQFAAOBgQCdqasaIO6JiV5ONFG6Tr1++85UfEdZKMUX
18N2NHiNNUunolIZEYR+dW99ezKmHlDiQ/tMgoLVYpl2Ubho2pAkLGQR+W0ZASgWQ1
19NjfV27Rv0y6lYQMTA0lVAU93L1x9reo3FMedmL5+H+lIEpLCxEPtAJNISrJOneZB
20W5jDadwkoQ==
21-----END CERTIFICATE-----
diff --git a/plugins/tests/certs/server-key.pem b/plugins/tests/certs/server-key.pem
new file mode 100644
index 0000000..eacaeaa
--- /dev/null
+++ b/plugins/tests/certs/server-key.pem
@@ -0,0 +1,15 @@
1-----BEGIN RSA PRIVATE KEY-----
2MIICWwIBAAKBgQCnFjAbTbX2PL2V5NEjevxGE1Tfyzr2jknoMqFXS6BsLsI2oJPl
35gs7wqh2UafJZwi2suwDvAECO00jdNooQnEq4BgPTk/h3IiCdZef5BGFALgNT0em
4Civ0+9d81AJTM8trbLoMefsUrEhMLF5Jp3udoyYhv8LhOQi09PaRfB0KhwIDAQAB
5AoGAfpxclcP8N3vteXErXURrd7pcXT0GECDgNjhvc9PV20RPXM+vYs1AA+fMeeQE
6TaRqwO6x016aMRO4rz5ztYArecTBznkds1k59pkN/Ne/nsueU4tvGK8MNyS2o986
7Voohqkaq4Lcy1bcHJb9su1ELjegEr1R76Mz452Hsy+uTbAECQQDcg/tZWKVeh5CQ
8dOEB3YWHwfn0NDgfPm/X2i2kAZ7n7URaUy/ffdlfsrr1mBtHCfedLoOxmmlNfEpM
9hXAAurSHAkEAwfk7fEb0iN0Sj9gTozO7c6Ky10KwePZyjVzqSQIiJq3NX8BEaIeb
1051TXxE5VxaLjjMLRkA0hWTYXClgERFZ6AQJAN7ChPqwzf08PRFwwIw911JY5cOHr
11NoDHMCUql5vNLNdwBruxgGjBB/kUXEfgw60RusFvgt/zLh1wiii844JDawJAGQBF
12sYP3urg7zzx7c3qUe5gJ0wLuefjR1PSX4ecbfb7DDMdcSdjIuG1QDiZGmd2f1KG7
13nwSCOtxk5dloW2KGAQJAQh/iBn0QhfKLFAP5eZBVk8E8XlZuw+S2DLy5SnBlIiYJ
14GB5I2OClgtudXMv1labFrcST8O9eFrtsrhU1iUGUOw==
15-----END RSA PRIVATE KEY-----
diff --git a/plugins/tests/check_http.t b/plugins/tests/check_http.t
index c5f9080..20078c2 100755
--- a/plugins/tests/check_http.t
+++ b/plugins/tests/check_http.t
@@ -12,26 +12,59 @@ use HTTP::Daemon;
12use HTTP::Status; 12use HTTP::Status;
13use HTTP::Response; 13use HTTP::Response;
14 14
15my $servers = { http => 0 }; # HTTP::Daemon should always be available
16eval { require HTTP::Daemon::SSL };
17if ($@) {
18 diag "Cannot load HTTP::Daemon::SSL: $@";
19} else {
20 $servers->{https} = 0;
21}
22
15# set a fixed version, so the header size doesn't vary 23# set a fixed version, so the header size doesn't vary
16$HTTP::Daemon::VERSION = "1.00"; 24$HTTP::Daemon::VERSION = "1.00";
17 25
18my $port = 50000 + int(rand(1000)); 26my $port_http = 50000 + int(rand(1000));
27my $port_https = $port_http + 1;
19 28
20my $pid = fork(); 29# Start up both servers
21if ($pid) { 30my $pid_https;
31my $pid_http = fork();
32if ($pid_http) {
22 # Parent 33 # Parent
23 #print "parent\n"; 34 if (exists $servers->{https}) {
24 # give our webserver some time to startup 35 # Fork another server
36 $pid_https = fork();
37 if ($pid_https) {
38 # Parent
39 } else {
40 my $d = HTTP::Daemon::SSL->new(
41 LocalPort => $port_https,
42 LocalAddr => "127.0.0.1",
43 SSL_cert_file => "$Bin/certs/server-cert.pem",
44 SSL_key_file => "$Bin/certs/server-key.pem",
45 ) || die;
46 print "Please contact https at: <URL:", $d->url, ">\n";
47 run_server( $d );
48 exit;
49 }
50 }
51 # give our webservers some time to startup
25 sleep(1); 52 sleep(1);
26} else { 53} else {
27 # Child 54 # Child
28 #print "child\n"; 55 #print "child\n";
29
30 my $d = HTTP::Daemon->new( 56 my $d = HTTP::Daemon->new(
31 LocalPort => $port, 57 LocalPort => $port_http,
32 LocalAddr => "127.0.0.1", 58 LocalAddr => "127.0.0.1",
33 ) || die; 59 ) || die;
34 print "Please contact me at: <URL:", $d->url, ">\n"; 60 print "Please contact http at: <URL:", $d->url, ">\n";
61 run_server( $d );
62 exit;
63}
64
65# Run the same server on http and https
66sub run_server {
67 my $d = shift;
35 while (my $c = $d->accept ) { 68 while (my $c = $d->accept ) {
36 while (my $r = $c->get_request) { 69 while (my $r = $c->get_request) {
37 if ($r->method eq "GET" and $r->url->path =~ m^/statuscode/(\d+)^) { 70 if ($r->method eq "GET" and $r->url->path =~ m^/statuscode/(\d+)^) {
@@ -70,140 +103,173 @@ if ($pid) {
70 $c->close; 103 $c->close;
71 } 104 }
72 } 105 }
73 exit;
74} 106}
75 107
76END { if ($pid) { print "Killing $pid\n"; kill "INT", $pid } }; 108END {
109 foreach my $pid ($pid_http, $pid_https) {
110 if ($pid) { print "Killing $pid\n"; kill "INT", $pid }
111 }
112};
77 113
78if ($ARGV[0] && $ARGV[0] eq "-d") { 114if ($ARGV[0] && $ARGV[0] eq "-d") {
79 sleep 1000; 115 sleep 1000;
80} 116}
81 117
118my $common_tests = 47;
82if (-x "./check_http") { 119if (-x "./check_http") {
83 plan tests => 47; 120 plan tests => $common_tests * 2;
84} else { 121} else {
85 plan skip_all => "No check_http compiled"; 122 plan skip_all => "No check_http compiled";
86} 123}
87 124
88my $result; 125my $result;
89my $command = "./check_http -H 127.0.0.1 -p $port"; 126my $command = "./check_http -H 127.0.0.1";
90
91$result = NPTest->testCmd( "$command -u /file/root" );
92is( $result->return_code, 0, "/file/root");
93like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - 274 bytes in [\d\.]+ seconds/', "Output correct" );
94 127
95$result = NPTest->testCmd( "$command -u /file/root -s Root" ); 128run_common_tests( { command => "$command -p $port_http" } );
96is( $result->return_code, 0, "/file/root search for string"); 129SKIP: {
97TODO: { 130 skip "HTTP::Daemon::SSL not installed", $common_tests if ! exists $servers->{https};
98local $TODO = "Output is different if a string is requested - should this be right?"; 131 run_common_tests( { command => "$command -p $port_https", ssl => 1 } );
99like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - 274 bytes in [\d\.]+ seconds/', "Output correct" );
100} 132}
101 133
102$result = NPTest->testCmd( "$command -u /slow" ); 134sub run_common_tests {
103is( $result->return_code, 0, "/file/root"); 135 my ($opts) = @_;
104like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - 177 bytes in ([\d\.]+) seconds/', "Output correct" ); 136 my $command = $opts->{command};
105$result->output =~ /in ([\d\.]+) seconds/; 137 my $b;
106cmp_ok( $1, ">", 1, "Time is > 1 second" ); 138 my $add = 0;
107 139 if ($opts->{ssl}) {
108my $cmd; 140 $command .= " --ssl";
109$cmd = "$command -u /statuscode/200 -e 200"; 141 }
110$result = NPTest->testCmd( $cmd );
111is( $result->return_code, 0, $cmd);
112like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - 89 bytes in ([\d\.]+) seconds/', "Output correct: ".$result->output );
113
114$cmd = "$command -u /statuscode/201 -e 201";
115$result = NPTest->testCmd( $cmd );
116is( $result->return_code, 0, $cmd);
117like( $result->output, '/^HTTP OK HTTP/1.1 201 Created - 94 bytes in ([\d\.]+) seconds /', "Output correct: ".$result->output );
118
119$cmd = "$command -u /statuscode/201 -e 200";
120$result = NPTest->testCmd( $cmd );
121is( $result->return_code, 2, $cmd);
122like( $result->output, '/^HTTP CRITICAL - Invalid HTTP response received from host on port \d+: HTTP/1.1 201 Created/', "Output correct: ".$result->output );
123
124$cmd = "$command -u /statuscode/200 -e 200,201,202";
125$result = NPTest->testCmd( $cmd );
126is( $result->return_code, 0, $cmd);
127like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - 89 bytes in ([\d\.]+) seconds/', "Output correct: ".$result->output );
128
129$cmd = "$command -u /statuscode/201 -e 200,201,202";
130$result = NPTest->testCmd( $cmd );
131is( $result->return_code, 0, $cmd);
132like( $result->output, '/^HTTP OK HTTP/1.1 201 Created - 94 bytes in ([\d\.]+) seconds/', "Output correct: ".$result->output );
133
134$cmd = "$command -u /statuscode/203 -e 200,201,202";
135$result = NPTest->testCmd( $cmd );
136is( $result->return_code, 2, $cmd);
137like( $result->output, '/^HTTP CRITICAL - Invalid HTTP response received from host on port (\d+): HTTP/1.1 203 Non-Authoritative Information/', "Output correct: ".$result->output );
138
139$cmd = "$command -j HEAD -u /method";
140$result = NPTest->testCmd( $cmd );
141is( $result->return_code, 0, $cmd);
142like( $result->output, '/^HTTP OK HTTP/1.1 200 HEAD - 19 bytes in ([\d\.]+) seconds/', "Output correct: ".$result->output );
143
144$cmd = "$command -j POST -u /method";
145$result = NPTest->testCmd( $cmd );
146is( $result->return_code, 0, $cmd);
147like( $result->output, '/^HTTP OK HTTP/1.1 200 POST - 19 bytes in ([\d\.]+) seconds/', "Output correct: ".$result->output );
148
149$cmd = "$command -j GET -u /method";
150$result = NPTest->testCmd( $cmd );
151is( $result->return_code, 0, $cmd);
152like( $result->output, '/^HTTP OK HTTP/1.1 200 GET - 18 bytes in ([\d\.]+) seconds/', "Output correct: ".$result->output );
153
154$cmd = "$command -u /method";
155$result = NPTest->testCmd( $cmd );
156is( $result->return_code, 0, $cmd);
157like( $result->output, '/^HTTP OK HTTP/1.1 200 GET - 18 bytes in ([\d\.]+) seconds/', "Output correct: ".$result->output );
158
159$cmd = "$command -P foo -u /method";
160$result = NPTest->testCmd( $cmd );
161is( $result->return_code, 0, $cmd);
162like( $result->output, '/^HTTP OK HTTP/1.1 200 POST - 19 bytes in ([\d\.]+) seconds/', "Output correct: ".$result->output );
163
164$cmd = "$command -j DELETE -u /method";
165$result = NPTest->testCmd( $cmd );
166is( $result->return_code, 1, $cmd);
167like( $result->output, '/^HTTP WARNING: HTTP/1.1 405 Method Not Allowed/', "Output correct: ".$result->output );
168
169$cmd = "$command -j foo -u /method";
170$result = NPTest->testCmd( $cmd );
171is( $result->return_code, 2, $cmd);
172like( $result->output, '/^HTTP CRITICAL: HTTP/1.1 501 Not Implemented/', "Output correct: ".$result->output );
173
174$cmd = "$command -P stufftoinclude -u /postdata -s POST:stufftoinclude";
175$result = NPTest->testCmd( $cmd );
176is( $result->return_code, 0, $cmd);
177like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - ([\d\.]+) second/', "Output correct: ".$result->output );
178
179$cmd = "$command -j PUT -P stufftoinclude -u /postdata -s PUT:stufftoinclude";
180$result = NPTest->testCmd( $cmd );
181is( $result->return_code, 0, $cmd);
182like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - ([\d\.]+) second/', "Output correct: ".$result->output );
183
184# To confirm that the free doesn't segfault
185$cmd = "$command -P stufftoinclude -j PUT -u /postdata -s PUT:stufftoinclude";
186$result = NPTest->testCmd( $cmd );
187is( $result->return_code, 0, $cmd);
188like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - ([\d\.]+) second/', "Output correct: ".$result->output );
189
190$cmd = "$command -u /redirect";
191$result = NPTest->testCmd( $cmd );
192is( $result->return_code, 0, $cmd);
193like( $result->output, '/^HTTP OK - HTTP/1.1 301 Moved Permanently - [\d\.]+ second/', "Output correct: ".$result->output );
194
195$cmd = "$command -f follow -u /redirect";
196$result = NPTest->testCmd( $cmd );
197is( $result->return_code, 0, $cmd);
198like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - 183 bytes in [\d\.]+ second/', "Output correct: ".$result->output );
199
200$cmd = "$command -u /redirect -k 'follow: me'";
201$result = NPTest->testCmd( $cmd );
202is( $result->return_code, 0, $cmd);
203like( $result->output, '/^HTTP OK - HTTP/1.1 301 Moved Permanently - [\d\.]+ second/', "Output correct: ".$result->output );
204
205$cmd = "$command -f follow -u /redirect -k 'follow: me'";
206$result = NPTest->testCmd( $cmd );
207is( $result->return_code, 0, $cmd);
208like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - 183 bytes in [\d\.]+ second/', "Output correct: ".$result->output );
209 142
143 $result = NPTest->testCmd( "$command -u /file/root" );
144 is( $result->return_code, 0, "/file/root");
145 like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - 274 bytes in [\d\.]+ seconds/', "Output correct" );
146
147 $result = NPTest->testCmd( "$command -u /file/root -s Root" );
148 is( $result->return_code, 0, "/file/root search for string");
149 TODO: {
150 local $TODO = "Output is different if a string is requested - should this be right?";
151 like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - 274 bytes in [\d\.]+ seconds/', "Output correct" );
152 }
153
154
155 $b = 177 + $add;
156 $result = NPTest->testCmd( "$command -u /slow" );
157 is( $result->return_code, 0, "/file/root");
158 like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - '.$b.' bytes in ([\d\.]+) seconds/', "Output correct" );
159 $result->output =~ /in ([\d\.]+) seconds/;
160 cmp_ok( $1, ">", 1, "Time is > 1 second" );
161
162 my $cmd;
163 $b = 89 + $add;
164 $cmd = "$command -u /statuscode/200 -e 200";
165 $result = NPTest->testCmd( $cmd );
166 is( $result->return_code, 0, $cmd);
167 like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - '.$b.' bytes in ([\d\.]+) seconds/', "Output correct: ".$result->output );
168
169 $b = 94 + $add;
170 $cmd = "$command -u /statuscode/201 -e 201";
171 $result = NPTest->testCmd( $cmd );
172 is( $result->return_code, 0, $cmd);
173 like( $result->output, '/^HTTP OK HTTP/1.1 201 Created - '.$b.' bytes in ([\d\.]+) seconds /', "Output correct: ".$result->output );
174
175 $cmd = "$command -u /statuscode/201 -e 200";
176 $result = NPTest->testCmd( $cmd );
177 is( $result->return_code, 2, $cmd);
178 like( $result->output, '/^HTTP CRITICAL - Invalid HTTP response received from host on port \d+: HTTP/1.1 201 Created/', "Output correct: ".$result->output );
179
180 $b = 89 + $add;
181 $cmd = "$command -u /statuscode/200 -e 200,201,202";
182 $result = NPTest->testCmd( $cmd );
183 is( $result->return_code, 0, $cmd);
184 like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - '.$b.' bytes in ([\d\.]+) seconds/', "Output correct: ".$result->output );
185
186 $b = 94 + $add;
187 $cmd = "$command -u /statuscode/201 -e 200,201,202";
188 $result = NPTest->testCmd( $cmd );
189 is( $result->return_code, 0, $cmd);
190 like( $result->output, '/^HTTP OK HTTP/1.1 201 Created - '.$b.' bytes in ([\d\.]+) seconds/', "Output correct: ".$result->output );
191
192 $cmd = "$command -u /statuscode/203 -e 200,201,202";
193 $result = NPTest->testCmd( $cmd );
194 is( $result->return_code, 2, $cmd);
195 like( $result->output, '/^HTTP CRITICAL - Invalid HTTP response received from host on port (\d+): HTTP/1.1 203 Non-Authoritative Information/', "Output correct: ".$result->output );
196
197 $b = 19 + $add;
198 $cmd = "$command -j HEAD -u /method";
199 $result = NPTest->testCmd( $cmd );
200 is( $result->return_code, 0, $cmd);
201 like( $result->output, '/^HTTP OK HTTP/1.1 200 HEAD - '.$b.' bytes in ([\d\.]+) seconds/', "Output correct: ".$result->output );
202
203 $b = 19 + $add;
204 $cmd = "$command -j POST -u /method";
205 $result = NPTest->testCmd( $cmd );
206 is( $result->return_code, 0, $cmd);
207 like( $result->output, '/^HTTP OK HTTP/1.1 200 POST - '.$b.' bytes in ([\d\.]+) seconds/', "Output correct: ".$result->output );
208
209 $b = 18 + $add;
210 $cmd = "$command -j GET -u /method";
211 $result = NPTest->testCmd( $cmd );
212 is( $result->return_code, 0, $cmd);
213 like( $result->output, '/^HTTP OK HTTP/1.1 200 GET - '.$b.' bytes in ([\d\.]+) seconds/', "Output correct: ".$result->output );
214
215 $b = 18 + $add;
216 $cmd = "$command -u /method";
217 $result = NPTest->testCmd( $cmd );
218 is( $result->return_code, 0, $cmd);
219 like( $result->output, '/^HTTP OK HTTP/1.1 200 GET - '.$b.' bytes in ([\d\.]+) seconds/', "Output correct: ".$result->output );
220
221 $b = 19 + $add;
222 $cmd = "$command -P foo -u /method";
223 $result = NPTest->testCmd( $cmd );
224 is( $result->return_code, 0, $cmd);
225 like( $result->output, '/^HTTP OK HTTP/1.1 200 POST - '.$b.' bytes in ([\d\.]+) seconds/', "Output correct: ".$result->output );
226
227 $cmd = "$command -j DELETE -u /method";
228 $result = NPTest->testCmd( $cmd );
229 is( $result->return_code, 1, $cmd);
230 like( $result->output, '/^HTTP WARNING: HTTP/1.1 405 Method Not Allowed/', "Output correct: ".$result->output );
231
232 $cmd = "$command -j foo -u /method";
233 $result = NPTest->testCmd( $cmd );
234 is( $result->return_code, 2, $cmd);
235 like( $result->output, '/^HTTP CRITICAL: HTTP/1.1 501 Not Implemented/', "Output correct: ".$result->output );
236
237 $cmd = "$command -P stufftoinclude -u /postdata -s POST:stufftoinclude";
238 $result = NPTest->testCmd( $cmd );
239 is( $result->return_code, 0, $cmd);
240 like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - ([\d\.]+) second/', "Output correct: ".$result->output );
241
242 $cmd = "$command -j PUT -P stufftoinclude -u /postdata -s PUT:stufftoinclude";
243 $result = NPTest->testCmd( $cmd );
244 is( $result->return_code, 0, $cmd);
245 like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - ([\d\.]+) second/', "Output correct: ".$result->output );
246
247 # To confirm that the free doesn't segfault
248 $cmd = "$command -P stufftoinclude -j PUT -u /postdata -s PUT:stufftoinclude";
249 $result = NPTest->testCmd( $cmd );
250 is( $result->return_code, 0, $cmd);
251 like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - ([\d\.]+) second/', "Output correct: ".$result->output );
252
253 $cmd = "$command -u /redirect";
254 $result = NPTest->testCmd( $cmd );
255 is( $result->return_code, 0, $cmd);
256 like( $result->output, '/^HTTP OK - HTTP/1.1 301 Moved Permanently - [\d\.]+ second/', "Output correct: ".$result->output );
257
258 $b = 183 + $add;
259 $cmd = "$command -f follow -u /redirect";
260 $result = NPTest->testCmd( $cmd );
261 is( $result->return_code, 0, $cmd);
262 like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - '.$b.' bytes in [\d\.]+ second/', "Output correct: ".$result->output );
263
264 $cmd = "$command -u /redirect -k 'follow: me'";
265 $result = NPTest->testCmd( $cmd );
266 is( $result->return_code, 0, $cmd);
267 like( $result->output, '/^HTTP OK - HTTP/1.1 301 Moved Permanently - [\d\.]+ second/', "Output correct: ".$result->output );
268
269 $b = 183 + $add;
270 $cmd = "$command -f follow -u /redirect -k 'follow: me'";
271 $result = NPTest->testCmd( $cmd );
272 is( $result->return_code, 0, $cmd);
273 like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - '.$b.' bytes in [\d\.]+ second/', "Output correct: ".$result->output );
274
275}