Archived Forum Post

Index of archived forum posts


Adding x-amz-acl to Amazon S3 Upload

Nov 18 '14 at 03:30

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
x-amz-acl: public-read
Accept: */*
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 (v9.5.0.33 • 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:

32-bit Download:

64-bit Download:

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 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:

    domain: xxxxxx
    port: 80
    ssl: 0
      Opening connection directly to HTTP server.
      httpHostname: xxxxxxxx
      httpPort: 80
      ssl: 0
      connectElapsedMs: 374
      HTTP connection succeeded.
    connectTime: Elapsed time: 374 millisec
      sendHeaderElapsedMs: 0
        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:
        send_size: 3616
        Failed to write data to output.
      sendBodyElapsedMs: 1248
      Failed to send HTTP request body.


That update fixed the issue - thanks!