Chilkat Forum

Technologies => REST / HTTP / HTTPS => Topic started by: plokij909 on April 06, 2018, 11:52:20 PM

Title: S3 UploadBytes throwing error
Post by: plokij909 on April 06, 2018, 11:52:20 PM
Hi - I've just updated my ChilkatDLL and I'm now getting an error when using s3_uploadByes - "Bad Request" - did something change in the function call?

binaryRequestX:
        binaryRequest:
          fullRequest:
            a_synchronousRequest:
              generateRequestHeader:
                httpRequestGenStartLine:
                  genStartLine:
                    startLine: PUT /xxx/xxxx.jpg HTTP/1.1
                  --genStartLine
                --httpRequestGenStartLine
                addCookies:
                  Not auto-adding cookies.
                  sendCookies: 1
                  cookieDir:
                --addCookies
              --generateRequestHeader
              fullHttpRequest:
                domain: files.xxxx.com.s3-ap-southeast-2.amazonaws.com
                port: 443
                ssl: 1
                openHttpConnection:
                  Opening connection directly to HTTP server.
                  httpHostname: files.xxxx.com.s3-ap-southeast-2.amazonaws.com
                  httpPort: 443
                  tls: 1
                  HTTPS secure channel established.
                --openHttpConnection
                connectTime: Elapsed time: 670 millisec
                sendRequestHeader:
                  sendHeaderElapsedMs: 0
                --sendRequestHeader
                sendRequestBody:
                  sendBodyElapsedMs: 0
                --sendRequestBody
                statusCode: 400
                statusText: Bad Request

                checkCloseConnection:
                  Response includes connection:close header (or proxy-connection:close header)
                --checkCloseConnection
              --fullHttpRequest
              success: 1
            --a_synchronousRequest
            success: 1
          --fullRequest
          responseStatus: 400
          Failed.
        --binaryRequest
      --binaryRequestX
      responseBody:
    --s3__uploadData
    Failed.
  --S3_UploadBytes
--ChilkatLog
Title: Re: S3 UploadBytes throwing error
Post by: Chilkat on April 07, 2018, 12:18:02 PM
Make sure to set both the AwsRegion and AwsEndpoint properties.
For example:

http.AwsRegion = "ap-southeast-2";
http.AwsEndpoint = "s3-ap-southeast-2.amazonaws.com";

Title: Re: S3 UploadBytes throwing error
Post by: plokij909 on April 08, 2018, 07:23:11 AM
That worked! Thank you!