DarkDucke 2 Posted November 18, 2019 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; HttpCli.PostASync; 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; var bFlag : Boolean; Msg : TMessage; begin 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 FCtrlSocket.Abort; FStatusCode := 200; FReasonPhrase := 'OK'; FRequestDoneError := httperrNoError; FState := httpReady; TriggerStateChange; WMHttpRequestDone(Msg); { Synchronous operation ! } Exit; end; bFlag := (FState = httpDnsLookup); StateChange(httpAborting); if bFlag then begin try FCtrlSocket.CancelDnsLookup; except { Ignore any exception } end; end; FStatusCode := 404; FReasonPhrase := 'Connection aborted on request'; FRequestDoneError := httperrAborted; if bFlag then SocketSessionClosed(Self, 0) else FCtrlSocket.Close; StateChange(httpReady); { 13/02/99 } end; 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
Angus Robertson 574 Posted November 19, 2019 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. Angus Share this post Link to post