/
Socket.pm
903 lines (699 loc) · 23.3 KB
/
Socket.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
package Test::Nginx::Socket;
use lib 'lib';
use lib 'inc';
use Test::Base -Base;
our $VERSION = '0.11';
use Encode;
use Data::Dumper;
use Time::HiRes qw(sleep time);
use Test::LongString;
use List::MoreUtils qw( any );
use IO::Select ();
our $ServerAddr = 'localhost';
our $Timeout = $ENV{TEST_NGINX_TIMEOUT} || 2;
use Test::Nginx::Util qw(
setup_server_root
write_config_file
get_canon_version
get_nginx_version
trim
show_all_chars
parse_headers
run_tests
$ServerPortForClient
$ServerPort
$PidFile
$ServRoot
$ConfFile
$RunTestHelper
$RepeatEach
worker_connections
master_process_enabled
config_preamble
repeat_each
workers
master_on
log_level
no_shuffle
no_root_location
server_root
html_dir
server_port
no_nginx_manager
);
#use Smart::Comments::JSON '###';
use Fcntl qw(F_GETFL F_SETFL O_NONBLOCK);
use POSIX qw(EAGAIN);
use IO::Socket;
#our ($PrevRequest, $PrevConfig);
our $NoLongString = undef;
our @EXPORT = qw( plan run_tests run_test
repeat_each config_preamble worker_connections
master_process_enabled
no_long_string workers master_on
log_level no_shuffle no_root_location
server_addr server_root html_dir server_port
timeout no_nginx_manager
);
sub send_request ($$$$);
sub run_test_helper ($$);
sub error_event_handler ($);
sub read_event_handler ($);
sub write_event_handler ($);
sub no_long_string () {
$NoLongString = 1;
}
sub server_addr (@) {
if (@_) {
#warn "setting server addr to $_[0]\n";
$ServerAddr = shift;
} else {
return $ServerAddr;
}
}
sub timeout (@) {
if (@_) {
$Timeout = shift;
} else {
$Timeout;
}
}
$RunTestHelper = \&run_test_helper;
sub parse_request ($$) {
my ($name, $rrequest) = @_;
open my $in, '<', $rrequest;
my $first = <$in>;
if (!$first) {
Test::More::BAIL_OUT("$name - Request line should be non-empty");
die;
}
$first =~ s/^\s+|\s+$//gs;
my ($meth, $rel_url) = split /\s+/, $first, 2;
if (!defined $rel_url) {
$rel_url = "/";
}
#my $url = "http://localhost:$ServerPortForClient" . $rel_url;
my $content = do { local $/; <$in> };
if (!defined $content) {
$content = "";
}
#warn Dumper($content);
close $in;
return {
method => $meth,
url => $rel_url,
content => $content,
};
}
sub run_test_helper ($$) {
my ($block, $dry_run) = @_;
my $name = $block->name;
my $req;
if (defined $block->raw_request) {
$req = $block->raw_request;
} else {
my $request;
if (defined $block->request_eval) {
$request = eval $block->request_eval;
if ($@) {
warn $@;
}
} else {
$request = $block->request;
}
my $is_chunked = 0;
my $more_headers = '';
if ($block->more_headers) {
my @headers = split /\n+/, $block->more_headers;
for my $header (@headers) {
next if $header =~ /^\s*\#/;
my ($key, $val) = split /:\s*/, $header, 2;
if (lc($key) eq 'transfer-encoding' and $val eq 'chunked') {
$is_chunked = 1;
}
#warn "[$key, $val]\n";
$more_headers .= "$key: $val\r\n";
}
}
if ($block->pipelined_requests) {
my $reqs = $block->pipelined_requests;
if (!ref $reqs || ref $reqs ne 'ARRAY') {
Test::More::BAIL_OUT("$name - invalid entries in --- pipelined_requests");
}
my $i = 0;
for my $request (@$reqs) {
my $conn_type;
if ($i++ == @$reqs - 1) {
$conn_type = 'close';
} else {
$conn_type = 'keep-alive';
}
my $parsed_req = parse_request($name, \$request);
my $len_header = '';
if (!$is_chunked && defined $parsed_req->{content}
&& $parsed_req->{content} ne ''
&& $more_headers !~ /\bContent-Length:/)
{
$parsed_req->{content} =~ s/^\s+|\s+$//gs;
$len_header .= "Content-Length: " . length($parsed_req->{content}) . "\r\n";
}
$req .= "$parsed_req->{method} $parsed_req->{url} HTTP/1.1\r
Host: localhost\r
Connection: $conn_type\r
$more_headers$len_header\r
$parsed_req->{content}";
}
} else {
my $parsed_req = parse_request($name, \$request);
### $parsed_req
my $len_header = '';
if (!$is_chunked && defined $parsed_req->{content}
&& $parsed_req->{content} ne ''
&& $more_headers !~ /\bContent-Length:/)
{
$parsed_req->{content} =~ s/^\s+|\s+$//gs;
$len_header .= "Content-Length: " . length($parsed_req->{content}) . "\r\n";
}
$req = "$parsed_req->{method} $parsed_req->{url} HTTP/1.1\r
Host: localhost\r
Connection: Close\r
$more_headers$len_header\r
$parsed_req->{content}";
}
}
if (!$req) {
Test::More::BAIL_OUT("$name - request empty");
}
#warn "request: $req\n";
my $timeout = $block->timeout;
if (!defined $timeout) {
$timeout = $Timeout;
}
my $raw_resp;
if ($dry_run) {
$raw_resp = "200 OK HTTP/1.0\r\nContent-Length: 0\r\n\r\n";
} else {
$raw_resp = send_request($req, $block->raw_request_middle_delay,
$timeout, $block->name);
}
#warn "raw resonse: [$raw_resp]\n";
my $raw_headers = '';
if ($raw_resp =~ /(.*?)\r\n\r\n/s) {
#warn "\$1: $1";
$raw_headers = $1;
}
#warn "raw headers: $raw_headers\n";
my $res = HTTP::Response->parse($raw_resp);
my $enc = $res->header('Transfer-Encoding');
if (defined $enc && $enc eq 'chunked') {
#warn "Found chunked!";
my $raw = $res->content;
if (!defined $raw) {
$raw = '';
}
my $decoded = '';
while (1) {
if ($raw =~ /\G 0 [\ \t]* \r\n \r\n /gcsx) {
last;
}
if ($raw =~ m{ \G [\ \t]* ( [A-Fa-f0-9]+ ) [\ \t]* \r\n }gcsx) {
my $rest = hex($1);
#warn "chunk size: $rest\n";
my $bit_sz = 32765;
while ($rest > 0) {
my $bit = $rest < $bit_sz ? $rest : $bit_sz;
#warn "bit: $bit\n";
if ($raw =~ /\G(.{$bit})/gcs) {
$decoded .= $1;
#warn "decoded: [$1]\n";
} else {
fail("$name - invalid chunked data received (not enought octets for the data section)");
return;
}
$rest -= $bit;
}
if ($raw !~ /\G\r\n/gcs) {
fail("$name - invalid chunked data received (expected CRLF).");
return;
}
} elsif ($raw =~ /\G.+/gcs) {
fail "$name - invalid chunked body received: $&";
return;
} else {
fail "$name - no last chunk found - $raw";
return;
}
}
#warn "decoded: $decoded\n";
$res->content($decoded);
}
if ($dry_run) {
SKIP: {
Test::More::skip("$name - tests skipped due to the lack of directive $dry_run", 1);
}
} else {
if (defined $block->error_code) {
is($res->code || '', $block->error_code, "$name - status code ok");
} else {
is($res->code || '', 200, "$name - status code ok");
}
}
if (defined $block->raw_response_headers_like) {
if ($dry_run) {
Test::More::skip("$name - tests skipped due to the lack of directive $dry_run", 1);
} else {
my $expected = $block->raw_response_headers_like;
like $raw_headers, qr/$expected/s, "$name - raw resp headers like";
}
}
if (defined $block->response_headers) {
my $headers = parse_headers($block->response_headers);
while (my ($key, $val) = each %$headers) {
if (!defined $val) {
#warn "HIT";
if ($dry_run) {
SKIP: {
Test::More::skip("$name - tests skipped due to the lack of directive $dry_run", 1);
}
} else {
unlike $raw_headers, qr/^\s*\Q$key\E\s*:/ms, "$name - header $key not present in the raw headers";
}
next;
}
my $actual_val = $res->header($key);
if (!defined $actual_val) {
$actual_val = '';
}
if ($dry_run) {
SKIP: {
Test::More::skip("$name - tests skipped due to the lack of directive $dry_run", 1);
}
} else {
is $actual_val, $val,
"$name - header $key ok";
}
}
} elsif (defined $block->response_headers_like) {
my $headers = parse_headers($block->response_headers_like);
while (my ($key, $val) = each %$headers) {
my $expected_val = $res->header($key);
if (!defined $expected_val) {
$expected_val = '';
}
if ($dry_run) {
SKIP: {
Test::More::skip("$name - tests skipped due to the lack of directive $dry_run", 1);
}
} else {
like $expected_val, qr/^$val$/,
"$name - header $key like ok";
}
}
}
if (defined $block->response_body
|| defined $block->response_body_eval) {
my $content = $res->content;
if (defined $content) {
$content =~ s/^TE: deflate,gzip;q=0\.3\r\n//gms;
$content =~ s/^Connection: TE, close\r\n//gms;
}
my $expected;
if ($block->response_body_eval) {
$expected = eval $block->response_body_eval;
if ($@) {
warn $@;
}
} else {
$expected = $block->response_body;
}
if ($block->charset) {
Encode::from_to($expected, 'UTF-8', $block->charset);
}
$expected =~ s/\$ServerPort\b/$ServerPort/g;
$expected =~ s/\$ServerPortForClient\b/$ServerPortForClient/g;
#warn show_all_chars($content);
#warn "no long string: $NoLongString";
if ($dry_run) {
SKIP: {
Test::More::skip("$name - tests skipped due to the lack of directive $dry_run", 1);
}
} else {
if ($NoLongString) {
is($content, $expected, "$name - response_body - response is expected");
} else {
is_string($content, $expected, "$name - response_body - response is expected");
}
}
} elsif (defined $block->response_body_like) {
my $content = $res->content;
if (defined $content) {
$content =~ s/^TE: deflate,gzip;q=0\.3\r\n//gms;
}
$content =~ s/^Connection: TE, close\r\n//gms;
my $expected_pat = $block->response_body_like;
$expected_pat =~ s/\$ServerPort\b/$ServerPort/g;
$expected_pat =~ s/\$ServerPortForClient\b/$ServerPortForClient/g;
my $summary = trim($content);
if ($dry_run) {
SKIP: {
Test::More::skip("$name - tests skipped due to the lack of directive $dry_run", 1);
}
} else {
like($content, qr/$expected_pat/s, "$name - response_body_like - response is expected ($summary)");
}
}
}
sub send_request ($$$$) {
my ($req, $middle_delay, $timeout, $name) = @_;
my @req_bits = ref $req ? @$req : ($req);
my $sock = IO::Socket::INET->new(
PeerAddr => $ServerAddr,
PeerPort => $ServerPortForClient,
Proto => 'tcp'
) or
die "Can't connect to $ServerAddr:$ServerPortForClient: $!\n";
my $flags = fcntl $sock, F_GETFL, 0
or die "Failed to get flags: $!\n";
fcntl $sock, F_SETFL, $flags | O_NONBLOCK
or die "Failed to set flags: $!\n";
my $ctx = {
resp => '',
write_offset => 0,
buf_size => 1024,
req_bits => \@req_bits,
write_buf => shift @req_bits,
middle_delay => $middle_delay,
sock => $sock,
name => $name,
};
my $readable_hdls = IO::Select->new($sock);
my $writable_hdls = IO::Select->new($sock);
my $err_hdls = IO::Select->new($sock);
while (1) {
if ($readable_hdls->count == 0 && $writable_hdls->count == 0 && $err_hdls->count == 0) {
last;
}
my ($new_readable, $new_writable, $new_err) =
IO::Select->select($readable_hdls, $writable_hdls,
$err_hdls, $timeout);
if (!defined $new_err && !defined $new_readable
&& !defined $new_writable)
{
# timed out
timeout_event_handler($ctx);
last;
}
for my $hdl (@$new_err) {
next if !defined $hdl;
error_event_handler($ctx);
if ($err_hdls->exists($hdl)) {
$err_hdls->remove($hdl);
}
if ($readable_hdls->exists($hdl)) {
$readable_hdls->remove($hdl);
}
if ($writable_hdls->exists($hdl)) {
$writable_hdls->remove($hdl);
}
for my $h (@$readable_hdls) {
next if !defined $h;
if ($h eq $hdl) {
undef $h;
last;
}
}
for my $h (@$writable_hdls) {
next if !defined $h;
if ($h eq $hdl) {
undef $h;
last;
}
}
close $hdl;
}
for my $hdl (@$new_readable) {
next if !defined $hdl;
my $res = read_event_handler($ctx);
if (!$res) {
# error occured
if ($err_hdls->exists($hdl)) {
$err_hdls->remove($hdl);
}
if ($readable_hdls->exists($hdl)) {
$readable_hdls->remove($hdl);
}
if ($writable_hdls->exists($hdl)) {
$writable_hdls->remove($hdl);
}
for my $h (@$writable_hdls) {
next if !defined $h;
if ($h eq $hdl) {
undef $h;
last;
}
}
close $hdl;
}
}
for my $hdl (@$new_writable) {
next if !defined $hdl;
my $res = write_event_handler($ctx);
if (!$res) {
# error occured
if ($err_hdls->exists($hdl)) {
$err_hdls->remove($hdl);
}
if ($readable_hdls->exists($hdl)) {
$readable_hdls->remove($hdl);
}
if ($writable_hdls->exists($hdl)) {
$writable_hdls->remove($hdl);
}
close $hdl;
}
if ($res == 2) {
if ($writable_hdls->exists($hdl)) {
$writable_hdls->remove($hdl);
}
}
}
}
return $ctx->{resp};
}
sub timeout_event_handler ($) {
my $ctx = shift;
warn "ERROR: socket client: timed out - $ctx->{name}\n";
}
sub error_event_handler ($) {
warn "exception occurs on the socket: $!\n";
}
sub write_event_handler ($) {
my ($ctx) = @_;
while (1) {
return undef if !defined $ctx->{write_buf};
my $rest = length($ctx->{write_buf}) - $ctx->{write_offset};
#warn "offset: $write_offset, rest: $rest, length ", length($write_buf), "\n";
#die;
if ($rest > 0) {
my $bytes = syswrite($ctx->{sock}, $ctx->{write_buf}, $rest, $ctx->{write_offset});
if (!defined $bytes) {
if ($! == EAGAIN) {
#warn "write again...";
#sleep 0.002;
return 1;
}
my $errmsg = "write failed: $!";
warn "$errmsg\n";
if (!$ctx->{resp}) {
$ctx->{resp} = "$errmsg";
}
return undef;
}
#warn "wrote $bytes bytes.\n";
$ctx->{write_offset} += $bytes;
} else {
$ctx->{write_buf} = shift @{$ctx->{req_bits}} or return 2;
$ctx->{write_offset} = 0;
if (defined $ctx->{middle_delay}) {
#warn "sleeping..";
sleep $ctx->{middle_delay};
}
}
}
# impossible to reach here...
return undef;
}
sub read_event_handler ($) {
my ($ctx) = @_;
while (1) {
my $read_buf;
my $bytes = sysread($ctx->{sock}, $read_buf, $ctx->{buf_size});
if (!defined $bytes) {
if ($! == EAGAIN) {
#warn "read again...";
#sleep 0.002;
return 1;
}
$ctx->{resp} = "500 read failed: $!";
return undef;
}
if ($bytes == 0) {
return undef; # connection closed
}
$ctx->{resp} .= $read_buf;
#warn "read $bytes ($read_buf) bytes.\n";
}
# impossible to reach here...
return undef;
}
1;
__END__
=encoding utf-8
=head1 NAME
Test::Nginx::Socket - Socket-backed test scaffold for the Nginx C modules
=head1 SYNOPSIS
use Test::Nginx::Socket;
plan tests => $Test::Nginx::Socket::RepeatEach * 2 * blocks();
run_tests();
__DATA__
=== TEST 1: sanity
--- config
location /echo {
echo_before_body hello;
echo world;
}
--- request
GET /echo
--- response_body
hello
world
--- error_code: 200
=== TEST 2: set Server
--- config
location /foo {
echo hi;
more_set_headers 'Server: Foo';
}
--- request
GET /foo
--- response_headers
Server: Foo
--- response_body
hi
=== TEST 3: clear Server
--- config
location /foo {
echo hi;
more_clear_headers 'Server: ';
}
--- request
GET /foo
--- response_headers_like
Server: nginx.*
--- response_body
hi
=== TEST 3: chunk size too small
--- config
chunkin on;
location /main {
echo_request_body;
}
--- more_headers
Transfer-Encoding: chunked
--- request eval
"POST /main
4\r
hello\r
0\r
\r
"
--- error_code: 400
--- response_body_like: 400 Bad Request
=head1 DESCRIPTION
This module provides a test scaffold based on non-blocking L<IO::Socket> for automated testing in Nginx C module development.
This class inherits from L<Test::Base>, thus bringing all its
declarative power to the Nginx C module testing practices.
You need to terminate or kill any Nginx processes before running the test suite if you have changed the Nginx server binary. Normally it's as simple as
killall nginx
PATH=/path/to/your/nginx-with-memc-module:$PATH prove -r t
This module will create a temporary server root under t/servroot/ of the current working directory and starts and uses the nginx executable in the PATH environment.
You will often want to look into F<t/servroot/logs/error.log>
when things go wrong ;)
=head1 Sections supported
The following sections are supported:
=over
=item config
=item http_config
=item request
=item request_eval
=item more_headers
=item response_body
=item response_body_eval
=item response_body_like
=item response_headers
=item response_headers_like
=item error_code
=item raw_request
=item user_files
=item skip_nginx
=item skip_nginx2
Both string scalar and string arrays are supported as values.
=item raw_request_middle_delay
Delay in sec between sending successive packets in the "raw_request" array value.
=back
=head1 Samples
You'll find live samples in the following Nginx 3rd-party modules:
=over
=item ngx_echo
L<http://github.com/agentzh/echo-nginx-module>
=item ngx_chunkin
L<http://wiki.nginx.org/NginxHttpChunkinModule>
=item ngx_memc
L<http://wiki.nginx.org/NginxHttpMemcModule>
=item ngx_drizzle
L<http://github.com/chaoslawful/drizzle-nginx-module>
=item ngx_rds_json
L<http://github.com/agentzh/rds-json-nginx-module>
=item ngx_xss
L<http://github.com/agentzh/xss-nginx-module>
=item ngx_srcache
L<http://github.com/agentzh/srcache-nginx-module>
=item ngx_lua
L<http://github.com/chaoslawful/lua-nginx-module>
=item ngx_set_misc
L<http://github.com/agentzh/set-misc-nginx-module>
=item ngx_array_var
L<http://github.com/agentzh/array-var-nginx-module>
=item ngx_form_input
L<http://github.com/calio/form-input-nginx-module>
=item ngx_iconv
L<http://github.com/calio/iconv-nginx-module>
=item ngx_set_cconv
L<http://github.com/liseen/set-cconv-nginx-module>
=item ngx_postgres
L<http://github.com/FRiCKLE/ngx_postgres>
=item ngx_coolkit
L<http://github.com/FRiCKLE/ngx_coolkit>
=back
=head1 SOURCE REPOSITORY
This module has a Git repository on Github, which has access for all.
http://github.com/agentzh/test-nginx
If you want a commit bit, feel free to drop me a line.
=head1 AUTHOR
agentzh (章亦春) C<< <agentzh@gmail.com> >>
=head1 COPYRIGHT & LICENSE
Copyright (c) 2009, Taobao Inc., Alibaba Group (L<http://www.taobao.com>).
Copyright (c) 2009, agentzh C<< <agentzh@gmail.com> >>.
This module is licensed under the terms of the BSD license.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
=over
=item *
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
=item *
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
=item *
Neither the name of the Taobao Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
=back
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=head1 SEE ALSO
L<Test::Nginx::LWP>, L<Test::Base>.