App-DubiousHTTP
view release on metacpan or search on metacpan
lib/App/DubiousHTTP/TestServer.pm view on Meta::CPAN
$SELECT->handler($cl,0,$read,1,$write);
$SELECT->mask($cl,0,1);
}
sub _mustclose {
my $hdr = shift;
my $close;
my $type = $hdr =~m{^[A-Z]+ /} ? 'request':'response';
while ($hdr =~m{^Connection:[ \t]*(?:(close)|keep-alive)}mig) {
$close = $1 ? 1: ($close||-1);
}
if ($close) {
$close = 0 if $close<0;
$DEBUG && _debug("set close=$close because of connection header in $type");
} elsif ($hdr =~m{\A(?:.* )?HTTP/1\.(?:0|(1))}) {
$close = $1 ? 0:1;
$DEBUG && _debug("set close=$close because of HTTP version in $type");
} else {
$close = 1;
lib/App/DubiousHTTP/Tests/Clen.pm view on Meta::CPAN
"playing with content-length",
<<'DESC',
These tests look at the behavior if the content-length mismatches the content,
e.g. content is short or longer then specified length or contradicting
content-lenth headers are given.
DESC
# ------------------------ Tests -----------------------------------
[ 'VALID: single or no content-length' ],
[ MUSTBE_VALID, 'close,clen,content' => 'single content-length with connection close'],
#[ VALID, 'keep-alive,clen,content' => 'single content-length with keep-alive'],
[ MUSTBE_VALID, 'close,content' => 'no content-length with connection close'],
[ UNCOMMON_INVALID, 'close,clen,content,junk' => 'single content-length, content followed by junk, then connection close'],
[ UNCOMMON_INVALID, 'close,clen,clen,content,junk' => 'correct content-length twice, content followed by junk, then connection close'],
[ UNCOMMON_VALID, 'close,000clen,content' => 'lots of 0 before clen' ],
[ UNCOMMON_VALID, 'close,000clen,content,junk' => 'lots of 0 before clen, body content+junk' ],
[ 'INVALID: content-length does not match content' ],
[ INVALID, 'close,clen200,content' => 'content-length double real content, close after real content' ],
[ INVALID, 'close,clen50,content' => 'content-length half real content, close after real content' ],
( run in 1.715 second using v1.01-cache-2.11-cpan-df04353d9ac )