Jump to content
Registration disabled at the moment Read more... ×
Estefanie

TSslHttpCli 404 Connection aborted on request

Recommended Posts

Hello guys, I am getting this error when doing a GET in a url.

"404 Connection aborted on request"

 

 SslHttpCli := TSslHttpCli.Create(nil);
     sendStream := TMemoryStream.Create;
     rcvStream := TMemoryStream.Create;
     SslHttpCli.SslContext :=  SslContext1.Create(nil);
     SslHttpCli.ServerAuth := httpAuthNone;
     SslHttpCli.Connection := 'keep-alive';
     SSlHttpCli.ProxyConnection := 'Keep-Alive';
     SslHttpCli.MultiThreaded := true;


     SslHttpCli.URL :=  'https://www.poemist.com/api/v1/randompoems';
      SslHttpCli.SendStream := sendStream;
     SslHttpCli.NoCache  := False;
     SslHttpCli.ContentTypePost := 'application/json';
     SslHttpCli.Accept := 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';

 

         try
         SslHttpCli.Get;
         stringStream := TStringStream.Create('', TEncoding.UTF8);
         stringStream.LoadFromStream(SslHttpCli.RcvdStream);
         data := stringStream.DataString;
         mResult.Lines.Add(data);
         stringStream.Free;

Share this post


Link to post

I suggest you build the OverbyteIcsHttpRestTst.dpr sample first and test your URL using that, then change your code to use TSslHttpRest instead of TSslHttpCli. it is much easier to use and the sample has several examples of how easy.

 

Angus

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×