Using the following Delphi XE2 code (Update 4):
var ConInfo: TAmazonConnectionInfo; RespInfo: TCloudResponseInfo; Service: TAmazonStorageService; Content: TBytes; Headers: TStringList; begin ConInfo:=TAmazonConnectionInfo.Create(self); ConInfo.AccountName:='YOUR ACCOUNT NAME'; ConInfo.AccountKey:='YOUR ACCOUNT KEY'; ConInfo.Protocol:='http'; Service:=TAmazonStorageService.Create(ConInfo); RespInfo:=TCloudResponseInfo.Create; SetLength(Content, 128); FillMemory(@Content[0], 128, Byte('x')); Headers:=TStringList.Create; Headers.Values['Content-type']:='text/plain'; if not Service.UploadObject('YOUR BUCKET', 'test.txt', Content, TRUE, nil, Headers, amzbaPrivate, RespInfo) then ShowMessage('Failed:' + RespInfo.StatusMessage);
I always get an error when I call UploadObject:
Error: HTTP / 1.1 403 Forbidden. The signature we signed for the request does not match the signature you provided. Check your key and sign the method. (SignatureDoesNotMatch)
This only happens when the content type is set to text / plain, text / html, or text. Using exactly the same code, if you just change the content type to any other type of content, for example. 'video / 3gpp' then it works as expected and without errors. The actual contents of the downloaded object is not relevant and does not affect the receipt of an error or not.
I traced the Indy code in Delphi, but I am at a dead end why the type of text content always gives this error.
Any ideas?
source share