login about faq

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

http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUTacl.html

How I can add this header (x-amz-acl: public-read) to:

http.S3_UploadBytes(...);

asked Nov 18 '13 at 19:22

chilkat's gravatar image

chilkat ♦♦
11.8k316358420


Call http.SetRequestHeader("x-amz-acl","public-read") prior to calling S3_UploadBytes.

link

answered Nov 18 '13 at 19:23

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

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

link

answered May 10 '14 at 03:24

pschuster's gravatar image

pschuster
161

Please try this new ActiveX build:

32-bit Download: http://www.chilkatsoft.com/download/preRelease/ChilkatAx-9.5.0-win32.zip

64-bit Download: http://www.chilkatsoft.com/download/preRelease/ChilkatAx-9.5.0-x64.zip

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

link

answered Nov 17 '14 at 10:00

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

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
link

answered Nov 16 '14 at 06:47

bluesix's gravatar image

bluesix
16236

That update fixed the issue - thanks!

link

answered Nov 18 '14 at 03:29

bluesix's gravatar image

bluesix
16236

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×50
×15
×8
×1

Asked: Nov 18 '13 at 19:22

Seen: 3,726 times

Last updated: Nov 18 '14 at 03:30

powered by OSQA