I want put a public object on S3. According to the Amazon manual I have to send the this header:
PUT ExampleObject.txt?acl HTTP/1.1 Host: examplebucket.s3.amazonaws.com x-amz-acl: public-read Accept: */* Authorization: AWS AKIAIOSFODNN7EXAMPLE:xQE0diMbLRepdf3YB+FIEXAMPLE= Host: s3.amazonaws.com Connection: Keep-Alive
How I can add this header (x-amz-acl: public-read) to:
Call http.SetRequestHeader("x-amz-acl","public-read") prior to calling S3_UploadBytes.
I use S3_UploadFile in the C++ Library (v126.96.36.199 • 21-Apr-2014 • MD5 Sum: b5427badb19990061f4be5eb4acb80d670b154d4 - Chilkat C/C++ Libs for VC++ 10.0 SP1 / win32) and it works fine. But when I add http.SetRequestHeader("x-amz-acl","public-read") I get an error-response 403 from the server. Commenting out SetRequestHeader and everything works fine.
Anyone can help?
I have read somewhere else that in other libraries (i.e. .NET) a bug existed that resulted in problems because a quotation mark has been inserted into the header - something like that. But these errors were discussed in 2012 so I believe these should be resolved now.
Thanks in advance, Phillip
Please try this new ActiveX build:
There was recent work involving the x-amz- headers -- to make sure they are properly included in the S3 authentication. I believe it should work now. It's already been tested with meta-data (x-amz-meta- headers). Please give it a test. If it does not work, then please let me know and I'll test the same..
This causes an error for me too. As with @pschuster, removing the SetRequestHeader method (shouldn't it be a property??) works correctly. The error output refers to http://www.cknotes.com/?p=217 which I've read but this seems like a bug.
Here's the error output (I've redacted my info with xxxxx's). The file I'm trying to upload is 131301 bytes:
fullHttpRequest: domain: xxxxxx port: 80 ssl: 0 openHttpConnection: Opening connection directly to HTTP server. httpHostname: xxxxxxxx httpPort: 80 ssl: 0 connectElapsedMs: 374 HTTP connection succeeded. --openHttpConnection connectTime: Elapsed time: 374 millisec sendRequestHeader: sendHeaderElapsedMs: 0 --sendRequestHeader sendRequestBody: sendFile: filePath: xxxxxxx Error sending on socket (1) SocketError: WSAECONNRESET An existing connection was forcibly closed by the remote host. For more information see this Chilkat Blog post: http://www.cknotes.com/?p=217 send_size: 3616 Failed to write data to output. --sendFile sendBodyElapsedMs: 1248 Failed to send HTTP request body. --sendRequestBody --fullHttpRequest
That update fixed the issue - thanks!