#1 2025-03-17 12:23:28

Alek
Member
From: Russia
Registered: 2014-07-04
Posts: 52

How can I reset HTTP_CLIENTERROR manually?

Hello everyone

A situation arises when working with TOpenApiClient - TJsonClient - TSimpleHttpClient mainly during debugging inside MVC server

- connection timeout occurs during step-by-step debugging in the IDE, after sending TOpenApiClient a request to the server
- when using the browser and when trying to re-request the MVC server by refreshing the page, the framework works, as it seems to me, in a contradictory way (mormot.net.client)
  - The function Request - RawConnect - SockConnected - shows the value "true"
  - The function fHttp.Request - sets the ctxt.Retry:= [rMain], then RequestInternal - fSock.Available(@loerr) - shows the value "false" and in DoRetry we get status=HTTP_CLIENTERROR

How can I reset this error condition manually?

Last edited by Alek (2025-03-17 13:29:56)

Offline

#2 2025-03-17 16:54:42

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,929
Website

Re: How can I reset HTTP_CLIENTERROR manually?

Which error condition exactly are you talking about?

Offline

#3 2025-03-19 07:28:51

Alek
Member
From: Russia
Registered: 2014-07-04
Posts: 52

Re: How can I reset HTTP_CLIENTERROR manually?

Good morning.

The translator doesn't always help me choose the right words.

After additional investigation, the TSimpleHttpClient.Request was discovered.

- I noticed the problem only when working with http
- the issue is with the hard-set {Retry}true parameter of the function
     result := fHttp.Request(
        Uri.Address, Method, KeepAlive, Header, Data, DataMimeType, {retry=}true);
-this parameter sets the ctxt.Retry := [rMain] property before attempting to reconnect again (if it is closed).
- next, when executing the THttpClientSocket.RequestInternal-DoRetry function (due to socket unavailability)
,the branch is executed:

if rMain in ctxt.Retry then
      // we should retry once -> return error only if failed twice
      ctxt.Status := FatalErrorCode

although there was no attempt to reopen the connection.

Last edited by Alek (2025-03-19 07:44:14)

Offline

Board footer

Powered by FluxBB