Apache2-S3
view release on metacpan or search on metacpan
lib/Apache2/S3.pm view on Meta::CPAN
unless ($f->r->content_type eq 'application/xml')
{
# S3 supports byte-range requests, but doesn't advertise it.
$f->r->headers_out->{'Accept-Ranges'} = 'bytes';
}
return Apache2::Const::DECLINED
}
$f->r->content_type('text/html');
$f->r->headers_out->unset('Content-Length');
$f->ctx($ctx = { text => "" })
}
$ctx->{text} .= $_
while $f->read($_);
return Apache2::Const::OK
unless $f->seen_eos;
my $ret = _reformat_directory($f, $ctx);
$f->r->headers_out->{'Content-Length'} = length $ret;
$f->print($ret);
$f->ctx(undef);
return Apache2::Const::OK;
}
1;
__END__
=head1 NAME
Apache2::S3 - mod_perl library for proxying requests to amazon S3
=head1 SYNOPSIS
PerlModule Apache2::S3;
PerlTransHandler Apache2::S3
PerlSetVar S3Key foo
PerlSetVar S3Secret bar
PerlSetVar S3Map '/path/ => amazon.s3.bucket.name'
# If you want to support non-GET requests
PerlSetVar S3ReadWrite 1
=head1 DESCRIPTION
This module will map requests for URLs on your server into proxy
requests to the Amazon S3 service, adding authentication headers
along the way to permit access to non-public resources.
It doesn't actually do any proxying itself, rather it just adds
the required authentication fields to the request and sets up mod_proxy
to handle it. Therefore you will need to enable mod_proxy like so:
ProxyRequests on
If you permit modification requests (PUT/DELETE) using the
S3ReadWrite feature then it is quite important that you protect
the url from untrusted requests using something like the following
on Apache 2.2:
<Proxy *>
<LimitExcept GET>
Order deny,allow
Deny from all
Allow from localhost
</LimitExcept>
</Proxy>
=head1 SEE ALSO
Apache::PassThru from Chapter 7 of "Writing Apache Modules with Perl and C"
http://www.modperl.com
Amazon S3 API
http://developer.amazonwebservices.com/connect/entry.jspa?entryID=123
=head1 AUTHOR
Iain Wade, E<lt>iwade@optusnet.com.auE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2007 by Iain Wade
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.8 or,
at your option, any later version of Perl 5 you may have available.
=cut
( run in 0.856 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )