mdbs99 / aws

Object Pascal implementation for Amazon S3
MIT License
75 stars 19 forks source link

DeleteObject not working? #3

Closed freedaun closed 9 years ago

freedaun commented 10 years ago

DeleteObject doesn't seem to work. The probable cause seems to be that Amazon requires this format (emphasis added):

DELETE /ObjectName HTTP/1.1 Host: BucketName.s3.amazonaws.com Date: date Content-Length: length Authorization: authorization string (see Authenticating Requests (AWS Signature Version 4))

(see http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectDELETE.html) and that the current code seems to use this format:

DELETE BucketName/ObjectName HTTP/1.1 Host: s3.amazonaws.com Date: date Content-Length: length Authorization: authorization string (see Authenticating Requests (AWS Signature Version 4))

The former format seems to be preferred for the other operations too, so the unit would need to be reworked a bit. I don't have the time to do so, and will use a work-around.

freedaun commented 10 years ago

do you have any plans to solve this?

freedaun commented 10 years ago

The below function seems to work:

function TAWSS3Client.DELETEObject(const ABucket, AObjectName: string): Integer; begin { TODO: not working yet } FHTTP.Clear; SetAuthHeader('DELETE', '', '', '', '/' + ABucket + '/' + AObjectName); // before: Result := Send('DELETE', ABucket, '/' + AObjectName); Result := Send('DELETE', '', '/'+ABucket +'/'+AObjectName); // new: seems to work end;

mdbs99 commented 9 years ago

Done in bef9a7fcc87136429be6c290af54e5ee5df523eb