Jump to content

adeptusgb

Members
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. My bad, I simplified the code a bit to make it more readable for the post and forgot to change the name of this variable. In the actual code it's the correct URL. I think the access violation was actually happening at jsonRes := SO(res); but it doesn't matter anyway because the AWS endpoint doesn't have a response body, so I took this part out of the code. That was the problem. The project only had OpenSSL v0.9.8.33 DLLs, I noticed there were some OpenSSL DLLs but didn't check if the version supported TLS 1.2 I actually had no idea about this software, looks very helpful and I'll be surely checking it out! Thank you so much for the help, I'm sending my files to S3 with no problems now!
  2. Hello, I'm having trouble trying to upload files to my s3 bucket in my Delphi 7 application. I have a python api that generates a presigned url for putting files, and it works perfectly. I am able to send the files to the s3 bucket through Postman, setting the body as binary and the url as the presigned s3 url. Now for the Delphi part, basically what my code does is get the presigned url and send a PUT to it with the TFileStream of a file selected by the user. var SignedURL , res , filePath : string; httpClient : TIdHTTP; SSLIOHandler : TIdSSLIOHandlerSocketOpenSSL; jsonRes : ISuperObject; fileStream : TFileStream begin filePath := 'path/to/file.pdf'; // file selected by user in OpenDialog SignedURL := 'signedUrlGeneratedByPythonCode'; // response from calling my python web api fileStream := TFileStream.Create(filePath, fmOpenRead or fmShareDenyNone); httpClient := TIdHTTP.Create; httpClient.Request.Accept := 'application/json'; SSLIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil); SSLIOHandler.SSLOptions.Method := sslvTLSv1_2; httpClient.IOHandler := SSLIOHandler; try res := httpClient.Put(url, fileStream); jsonRes := SO(res); finally fileStream.Free; httpClient.Free; SSLIOHandler.Free; end; end; With this code I get an access violation at the res := httpClient.Put(url, fileStream); if I run just the Put on runtime, without assigning the response to a variable I get a "Delphi exception EIdSocketError at $2646F905". Removing the SSLIOHandler, I get a "Socket Error #10054 Connection reset by peer.". I'm still a beginner in coding (and very new with Delphi), so I can't pinpoint what exactly could be the problem. I assume it's either because of AWS using HTTPS (although the python api also uses HTTPS and I don't need to set a SSLIOHandler to make a request to it) and my SSL/TLS not working properly or I'm passing the file binaries in the wrong format and the AWS server is refusing the connection instantly. Using: Delphi 7, Indy 10 Thanks in advance, any help would be very much appreciated.
×