0

Making a simple request to a password generator API (makemeapassword.ligos.net).

If I run it through the Fiddler proxy, it runs fine. When I close fiddler and turn off the proxy, it doesn't work. Error returned is "Socket Error # 10054 Connection reset by peer."

I've tried messing the SSLOptions.Method and Version but none of those are working. I've also updated the OpenSLL DLLs to the latest version with no luck. Any hints on where I should be looking?

Using Delphi 10 Seattle.

var
  HTTP: TIdHTTP;
  SSL: TIdSSLIOHandlerSocketOpenSSL;
  URL : String;
begin
  URL := TIdURI.URLEncode('https://makemeapassword.ligos.net/api/v1/passphrase/plain?pc=1&wc=4&sp=n&maxCh=64&whenNum=EndOfPhrase&nums=1&whenUp=StartOfWord&ups=4');

  HTTP := TIdHTTP.Create(nil);
  try
    {with Fiddler turned on, and these uncommented out, it works}
    {HTTP.ProxyParams.ProxyServer := '127.0.0.1';}
    {HTTP.ProxyParams.ProxyPort := 8888;}

    SSL := TIdSSLIOHandlerSocketOpenSSL.Create(HTTP);
    HTTP.IOHandler := SSL;

    HTTP.Get(URL);
  finally
    HTTP.Free;
  end;
FLDelphi
  • 508
  • 7
  • 20
  • 1
    Your use of `TIdURI` is unnecessary in this situation. Do you have the same problem if you remove `TIdURI`? Also, you say you upgraded the OpenSSL DLLs, but have you upgraded Indy itself? The version that shipped with Seattle is several years old, have you tried using an up-to-date version? Other than the use of `TIdURI`, I don't see any other problems with the code you have shown. – Remy Lebeau Dec 27 '18 at 01:46
  • I have tried without TidURI. As for upgrading Indy, I have a Delphi subscription so I can go to the latest Delphi. Will that be enough or do I need to update Indy independently of Delphi? – FLDelphi Dec 27 '18 at 14:03
  • I tested your problem-code in Delphi 10.1 Berlin Update 2 and Delphi 10.2 Tokyo Update 3 without getting an error. I use the Indy version shipped with those IDEs. – G Wimpassinger Dec 27 '18 at 16:39
  • @FLDelphi I was referring to upgrading indy itself, not Delphi. Instructions are on [Indy's website](http://www.indyproject.org/Sockets/Docs/Indy10Installation.EN.aspx). – Remy Lebeau Dec 27 '18 at 18:02
  • 1
    I cannot reproduce the issue when using the latest Indy 10.6.2.5491 snapshot with Delphi XE2. The website reports back a generated password, as expected. – Remy Lebeau Dec 28 '18 at 00:21
  • Roger that. Thanks for your time @RemyLebeau – FLDelphi Dec 28 '18 at 15:13

0 Answers0