Stor

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

1.0.0 2018-05-11T09:08:33Z
    - fix & improve documentation
    - configuration changes:
        - get_from_hcp renamed to s3_enabled
        - hcp_credentials renamed to s3_credentials
0.10.2 2018-05-10T14:20:30Z
    - Timings to statsite is now in miliseconds
0.10.1
    - Bugfix when zero-sized chunk is sent form hcp
0.10.0
    - Properly streaming files form hcp storage
0.9.0
    - writable_pairs_regex configuration (default all pairs)
0.6.0
    - Last-Modified header
0.5.0
    - cache support
0.4.4
   - lookup.attempt.[$attempt].count and lookup.time metrics added
   - remove Cpanel::JSON::XS dependency

lib/Stor.pm  view on Meta::CPAN

    $c->res->headers->last_modified($head_response->{'last-modified'});

    # get classic HTTP::Request for fetching the file
    my $http_request = Net::Amazon::S3::Request::GetObject->new(
        s3     => $self->bucket->account,
        bucket => $self->bucket->bucket,
        key    => $hcp_key,
        method => 'GET'
    )->http_request;

    # build Mojo request inside transaction for proper streaming
    $c->app->ua->max_response_size(0);
    my $tx = $c->app->ua->build_tx(GET => $http_request->uri->as_string);
    for my $header_key ('authorization', 'date') {
        $tx->req->headers->header($header_key => $http_request->headers->header($header_key));
    }

    $tx->res->content->unsubscribe('read')->on(
        read => sub {
            my (undef, $chunk) = @_;
            if ($chunk) {



( run in 0.244 second using v1.01-cache-2.11-cpan-4d50c553e7e )