App-Wallflower
view release on metacpan or search on metacpan
- tests for 304 in TAP mode
1.013 2018-09-06 BOOK
- fix handling of 301 in wallflower (broken in 1.010 .. 1.012)
- 301 redirects are not considered errors in TAP mode any more
- minor fixes in tests
1.012 2018-09-05 BOOK
- refactor parallel processing to more evenly distribute the work
between children (the parent won't process any URL)
- add support for delayed and streaming responses
(thanks to Ferruccio Zamuner (FERZ))
- fix tests that were failing under Win32 (after the move to Path::Tiny)
1.011 2018-09-01 BOOK
- improve the inter-process communication algorithm when running
in parallel mode
- Wallflower::Util links_from() now only returns relevant links
1.010 2018-08-31 BOOK
- add a --parallel option to wallflower, to fetch files in parallel
lib/Wallflower.pm view on Meta::CPAN
# request attributes
SCRIPT_NAME => '',
PATH_INFO => $uri->path,
REQUEST_URI => $uri->path,
QUERY_STRING => '',
SERVER_NAME => $self->url->host,
SERVER_PORT => $self->url->port,
SERVER_PROTOCOL => "HTTP/1.0",
# wallflower defaults
'psgi.streaming' => 1,
};
# add If-Modified-Since headers if the target file exists
my $target = $self->target($uri);
$env->{HTTP_IF_MODIFIED_SINCE} = time2str( ( stat _ )[9] ) if -e $target;
# fixup URI (needed to resolve relative URLs in retrieved documents)
$uri->scheme( $env->{'psgi.url_scheme'} ) if !$uri->scheme;
$uri->host( $env->{SERVER_NAME} ) if !$uri->host;
lib/Wallflower.pm view on Meta::CPAN
}
elsif ( ref $res eq 'CODE' ) {
# https://metacpan.org/pod/PSGI#Delayed-Response-and-Streaming-Body
$res->( sub {
my $response = shift;
# delayed response
( $status, $headers, $content ) = @$response;
# streaming
if ( !defined $content ) {
return bless {}, 'Wallflower::NULL'
if $status ne '200'; # we don't care about the body
return _build_handle( $file = $target );
}
return;
} );
}
else { croak "Unknown response from application: $res"; }
t/50-smoke.t view on Meta::CPAN
push @tests, [
'delayed response',
sub {
my $res = build_response(shift);
sub { shift->($res) }
},
@urls
];
push @tests, [
'streaming',
sub {
my $res = build_response(shift);
my $body = ref $res->[2] ? $res->[2][0] : $res->[2];
sub {
my $responder = shift;
my $writer = $responder->( [ @{$res}[ 0, 1 ] ] );
$writer->write( $body );
$writer->close;
}
},
( run in 0.251 second using v1.01-cache-2.11-cpan-4d50c553e7e )