Reputation: 43491
Using curl
, if I do:
curl -v --upload-file tumblr_nl29hydgtP1uq22wlo1_r2_1280.jpg https://s3.amazonaws.com/mybutcket/1_myfile\?AWSAccessKeyId\=mykey\&Expires\=1427991209\&Signature\=DzspMuzu5%2Fpo43PWriJdOZnF2FA%3D
It uploads just fine. However, when I try to upload in the browser, I get this error
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>SignatureDoesNotMatch</Code>
<Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>
<AWSAccessKeyId>mykey</AWSAccessKeyId>
<StringToSign>PUT
multipart/form-data
1427992617
/mybucket/1_myfile</StringToSign>
<SignatureProvided>dEyHSGBGcSmCfsZ1ahPryYTaB0U=</SignatureProvided>
<StringToSignBytes>50 55 54 0a 0a 6d 75 6c 74 69 70 61 72 74 2f 66 6f 72 6d 2d 64 61 74 61 0a 31 34 32 37 39 39 32 36 31 37 0a 2f 6d 6f 6e 65 67 72 61 70 68 2e 64 65 76 2e 75 70 6c 6f 61 64 73 2f 31 5f 6d 79 66 69 6c 65</StringToSignBytes>
<RequestId>F2C56B03E9F27E3F</RequestId>
<HostId>4sC6jReptppcxmE5yb5MvcZ70cB/gC0obCMEZHI+2zC/qqNFtxHd2wU2+niCHBHV</HostId>
</Error>
My Request Headers
are attached
Upvotes: 1
Views: 986
Reputation: 58002
Your curl command line uses --upload-file, which makes a HTTP PUT request.
Your browser "upload" is most likely not using PUT - based on the response you show you tried a multi-part formpost.
I would guess that the difference between these two is big enough to warrant the server to act and respond very differently. It isn't only the request method that is different but a multi-part formpost will also format the data in a way that the plain PUT doesn't.
Upvotes: 3