HTTP-Parser2-XS
view release on metacpan or search on metacpan
} elsif ($rv == -2 && length($buf) > 4096) {
# incomplete response header and too long already,
# no point allowing something like this
} elsif ($rv == -2) {
# incomplete response, call again when there is more data
# in the buffer
} else {
# $rv contains the length of the response header on success
}
if (exists $r->{'content-type'} &&
$r->{'content-type'}->[0] eq 'text/html')
{
# ...
}
if ($r->{'_status'} eq '200') {
# ...
}
DESCRIPTION
HTTP::Parser2::XS parses data into a bit different form making perl code
lib/HTTP/Parser2/XS.pm view on Meta::CPAN
# incomplete response header and too long already,
# no point allowing something like this
} elsif ($rv == -2) {
# incomplete response, call again when there is more data
# in the buffer
} else {
# $rv contains the length of the response header on success
}
if (exists $r->{'content-type'} &&
$r->{'content-type'}->[0] eq 'text/html')
{
# ...
}
if ($r->{'_status'} eq '200') {
# ...
}
t/01-simple.t view on Meta::CPAN
{
my $buf = "HTTP/1.0 200 OK\x0d\x0a".
"Host: localhost\x0d\x0a".
"Content-Type: text/html\x0d\x0a".
"\x0d\x0a".
"asdf";
my $r = {};
parse_http_response($buf, $r);
ok exists $r->{'content-type'}, "content-type header exists";
ok $r->{'content-type'}->[0] eq 'text/html', "correct content-type";
};
( run in 1.274 second using v1.01-cache-2.11-cpan-524268b4103 )