Comments (6)
Are you only getting signature errors when using UTF-8 headers? Do UTF-8 object names still work for you?
from amazon-s3-php-class.
I'm not sure exactly what you mean by UTF-8 object names. The 'keyword' header is always encoded as UTF-8 as is the actual content stored in S3 (search engine result page). Here is an example page we are trying to store that had a failure:
We set Content-Type to what is returned by the engine. In this case "text/html; charset=UTF-8". We also set Content-Encoding to "gzip" since we use "gzencode()" on the response.
from amazon-s3-php-class.
code for reproduce
S3::setAuth('XXX', 'XXX'); S3::setExceptions(true); $put = S3::putObject( S3::inputFile('1.txt'), 'your_bucket', '1.txt', S3::ACL_PUBLIC_READ, array( // Custom meta headers ), array( // Custom $requestHeaders "Cache-Control" => "max-age=315360000", "Expires" => gmdate("D, d M Y H:i:s T", strtotime("+5 years")), "Content-type" => "text/plain", ) ) var_dump($put);
Expected result
bool(true)
Actual result
Fatal error: Uncaught exception 'S3Exception' with message 'S3::putObject(): [SignatureDoesNotMatch] The request signature we calculated does not match the signa
ture you provided. Check your key and signing method.' in S3.class.php:554
HTML Request
PUT /uploads/1.txt HTTP/1.1
User-Agent: S3/php
Accept: /
x-amz-acl: public-read
Host: lingualeo_cdn.s3.amazonaws.com
Date: Sat, 16 Jun 2012 15:21:58 GMT
Content-MD5: aVSG6u6vFHNzw7+fh5KVCA==
Content-Type: text/plain
Cache-Control: max-age=315360000
Expires: Fri, 16 Jun 2017 15:21:58 GMT
Content-type: text/plain
Authorization: AWS AKIAJQPD6HCEUK55UXDQ:iac8pbUCyvYD2XhrnBwPEsb9K+o=
Content-Length: 8
Expect: 100-continue
HTML Response
HTTP/1.1 403 Forbidden
x-amz-request-id: 12631B4F2C527789
x-amz-id-2: pWcELTdRMhMpwLmzJY6aWppXRnqOWVJUJxVWB4ewOI6lDdmdQ9Kit/RgYiD1hscG
Content-Type: application/xml
Transfer-Encoding: chunked
Date: Sat, 16 Jun 2012 15:22:10 GMT
nnCoection: close
Server: AmazonS3
41b
SignatureDoesNotMatch
The request signature we calculated does not match the signature you provided. Check your key and signing method.50 55 54 0a 61 56 53 47 36 75 36 76 46 48 4e 7a 77 37 2b 66 68 35 4b 56 43 41 3d 3d 0a 74 65 78 74 2f 70 6c 61 69 6e 2c 74 65 78 74 2f 70 6c 61 69 6e 0a 53 61 74 2c 20 31 36 20 4a 75 6e 20 32 30 31 32 20 31 35 3a 32 31 3a 35 38 20 47 4d 54 0a 78 2d 61 6d 7a 2d 61 63 6c 3a 70 75 62 6c 69 63 2d 72 65 61 64 0a 2f 6c 69 6e 67 75 61 6c 65 6f 5f 63 64 6e 2f 75 70 6c 6f 61 64 73 2f 31 2e 74 78 7412631B4F2C527789pWcELTdRMhMpwLmzJY6aWppXRnqOWVJUJxVWB4ewOI6lDdmdQ9Kit/RgYiD1hscGiac8pbUCyvYD2XhrnBwPEsb9K+o=PUT
aVSG6u6vFHNzw7+fh5KVCA==
text/plain,text/plain
Sat, 16 Jun 2012 15:21:58 GMT
x-amz-acl:public-read
/lingualeo_cdn/uploads/1.txtAKIAJQPD6HCEUK55UXDQ
0
from amazon-s3-php-class.
Would you be able to try this patch? It seems like it is likely related to the meta header order.
from amazon-s3-php-class.
thanks! patch work fine...
may be you merged this patch to main project repository?
from amazon-s3-php-class.
The patch uses a lambda style function, it should ideally be a separate function for older PHP versions.
But I'm busy implementing it now, should push changes later today.
from amazon-s3-php-class.
Related Issues (20)
- S3.php uses AWS API that will be deprecated on June 6th 2019
- SignatureDoesNotMatch error HOT 2
- Easy fix for getObjectInfo bug
- Missing setSignatureVersion function HOT 1
- Issue on uploading in Asia Mumbai region bucket.
- S3.php is huge and is becoming unmanageable :(
- putObject problem
- AuthorizationHeaderMalformed: the region 'us-east-1' is wrong; expecting 'ap-northeast-1' HOT 3
- Access denied on deleteObject
- error messages
- Could I prevent invalidation?
- ListBuckets does not work on non-amazon services HOT 12
- Install region eu-west-1 default
- Does it support tagging? HOT 1
- Haveing 2 buckets in the same region
- Deprecated: Array and string offset access syntax with curly braces
- openssl_free_key() is deprecated in PHP8
- De-static-ified version of S3 with tagging
- PHP 8 Issues HOT 2
- How To Get Public URL Of Object After Uploading A File Object?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amazon-s3-php-class.