Jump to content
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×