Jump to content

TSslHttpCli 404 Connection aborted on request

Recommended Posts

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

"404 Connection aborted on request"


  xUrlPost := 'https://urltopost.com/8/pay';
  Buf := AnsiString('{"value":90}');
  DataOut := TMemoryStream.Create;
  if Length(Buf) > 0 then      { Check if some data to post }
      DataOut.Write(Buf[1], Length(Buf));
  DataOut.Seek(0, soBeginning);
  HttpCli.RcvdHeader.NameValueSeparator := ':';
  HttpCli.ContentTypePost := 'application/json';
  HttpCli.SendStream      := DataOut;
  HttpCli.RcvdStream      := TMemoryStream.Create;
  HttpCli.URL :=  xUrlPost;

in event "RequestDone" StatusCode = 404 and ReasonPhrase = "Connection aborted on request"

what does the message "Connection aborted on request"?

How can I get more details to correct the error?

I found this error message in unit "OverbyteIcsHttpProt" in procedure "THttpCli.Abort". but I don't use the "Abort" command at any time!


procedure THttpCli.Abort;
    bFlag : Boolean;
    Msg   : TMessage;
    FLocationFlag := FALSE;  { Do not follow relocations V7.10 }
    { The following two lines prevent OnRequestDone from trigger twice V7.10 }
    FRcvdCount    := 0;      { Clear the receive buffer V7.10 }
    FReceiveLen   := 0;      { Clear the receive buffer V7.10 }

    if FState = httpReady then begin
        FState := httpAborting;
        if FCtrlSocket.State <> wsClosed then
        FStatusCode       := 200;
        FReasonPhrase     := 'OK';
        FRequestDoneError := httperrNoError;
        FState            := httpReady;
        WMHttpRequestDone(Msg);   { Synchronous operation ! }

    bFlag := (FState = httpDnsLookup);

    if bFlag then begin
            { Ignore any exception }

    FStatusCode       := 404;
    FReasonPhrase     := 'Connection aborted on request';
    FRequestDoneError := httperrAborted;

    if bFlag then
        SocketSessionClosed(Self, 0)
    StateChange(httpReady);  { 13/02/99 }

I know error 404 as "page not found" but in this case the post url is correct. I copied the url from a post made from the browser!

Share this post

Link to post

If you want help with connection problems you need to give us real URLs, we can not waste time looking for code problems when the input or site is faulty.  Your previous post was a perfect example.


You should also test the site using the REST sample which has proper logging to show what is happening.  It will probably work, and you can then check why your own code fails. 


Please don't post ICS source code here, we have it already.




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