1

I use libcurl to put objects on amazon s3 service. Here is my original contents in a.txt:

aaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbb
cccccccccccccccccccccccccccaaaaaaaaaaaaaaaaaaaaaaaaaaa
ddddddddddddddddddddddddddd
eeeeeeeeeeeeeeeeeeeeeeeeeee

after put the a.txt on amazon s3, it becomes:

Accept: */*
Connection: TE
TE: gzip
Transfer-Encoding: chunked
Expect: 100-continue

ae
aaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbb
ccccccccccccccccccccc

I'm sure my s3key and s3secret key is correct because it's correct when I get objects

I have no ideas, please help me. thanks.

Here is my put headers:

PUT\n\ntext/plain\nWed, 09 Nov 2016 10:28:35 +0800\n/mybuckets/a.txt
Host: mybuckets.s3.amazonaws.com
Date: Wed, 09 Nov 2016 10:28:35 +0800
Content-Type: text/plain
Content-Length: 174
Authorization: AWS myS3key:mysigntobytes
yayaya
  • 79
  • 1
  • 10
  • 1
    Do you have an extra `\n` at the end of your `Authorization:` line, perhaps? It looks like your request headers are being interpreted as being terminated earlier than they should be, and by (bad) luck, your invalid request is just valid enough that S3 interprets it as a valid upload request. – Michael - sqlbot Nov 09 '16 at 03:32
  • @Michael-sqlbot yep, that's the problem . I use fgets() so it will add a '\n' to interupt the upload, is there anyway to avoid the behavior? – yayaya Nov 09 '16 at 03:53

0 Answers0