Subject: | Support for arbitrary headers |
Amazon has a feature where the requester of the data pays the access and
bandwidth charges. See:
http://developer.amazonwebservices.com/connect/message.jspa?messageID=123715
This requires adding the following line to the request headers:
"x-amz-request-payer : requester"
Apply the above patch and then instantiate a new S3 object like this:
my $s3 = Amazon::S3->new(
{ aws_access_key_id => $aws_access_key_id,
aws_secret_access_key => $aws_secret_access_key,
retry => 1,
s3_headers => { 'x-amz-request-payer' => 'requester'},
}
);
Subject: | Amazon-S3-0.45.patch |
diff -r old -r new cpan/Amazon-S3-0.45/lib/Amazon/S3/Bucket.pm
--- cpan/Amazon-S3-0.45/lib/Amazon/S3/Bucket.pm 2009-08-14 17:14:31.000000000 -0700
+++ cpan/Amazon-S3-0.45/lib/Amazon/S3/Bucket.pm 2009-12-04 18:33:50.000000000 -0800
@@ -72,7 +72,7 @@
$filename = $$filename if ref $filename;
my $acct = $self->account;
- my $request = $acct->_make_request($method, $self->_uri($key), {});
+ my $request = $acct->_make_request($method, $self->_uri($key), $acct->{s3_headers});
my $response = $acct->_do_http($request, $filename);
if ($response->code == 404) {
diff -r old -r new cpan/Amazon-S3-0.45/lib/Amazon/S3.pm
--- cpan/Amazon-S3-0.45/lib/Amazon/S3.pm 2009-08-14 17:14:32.000000000 -0700
+++ cpan/Amazon-S3-0.45/lib/Amazon/S3.pm 2009-12-04 18:48:55.000000000 -0800
@@ -144,19 +144,17 @@
map { $_ . "=" . $self->_urlencode($conf->{$_}) } keys %$conf);
}
- my $r = $self->_send_request('GET', $path, {});
+ my $r = $self->_send_request('GET', $path, $self->{s3_headers});
return undef unless $r && !$self->_remember_errors($r);
my $return = {
bucket => $r->{Name},
prefix => $r->{Prefix},
marker => $r->{Marker},
next_marker => $r->{NextMarker},
max_keys => $r->{MaxKeys},