#1 2022-07-05 17:26:28

tbo
Member
Registered: 2015-04-20
Posts: 353

Changes break source code

With mORMot 2.0.3383 from 2022-06-02 this source code still worked:

FRestClient: TRestHttpClient;

begin
  if not (FRestClient.Request is TWinHttpApi) then Exit; //=>
  TWinHttpApi(FRestClient.Request).OnUpload := DoShowUpload;
  Result := (FRestClient.CallBack(mPUT, methodName, pmvDataString, return) = HTTP_SUCCESS);

But via FRestClient.Socket (THttpClientSocket) I can't get the events (OnUpload/OnProgress) I need.
How do I write this now?

With best regards
Thomas

Offline

#2 2022-07-05 20:46:07

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

Re: Changes break source code

Sorry, but I don't understand your exact concern.

Is it a regression?
Or that your callback don't work on the other class?

Offline

#3 2022-07-06 10:20:41

tbo
Member
Registered: 2015-04-20
Posts: 353

Re: Changes break source code

ab wrote:

Sorry, but I don't understand your exact concern.

Sorry for being unclear.

You have made the following changes in the Unit mormot.rest.http.client:

{.$define CLIENTUSEWININET}
// force HTTP/1.1 RESTful JSON default mORMot Client class to use WinHttp
// - e.g. to try Windows built-in proxy settings
// - but is slower and less stable in some context (e.g. useHttpAsync) 

And more:

  {$ifdef CLIENTUSEWININET}

  /// force HTTP/1.1 RESTful JSON default mORMot Client class as WinHttp
  // - for support of Windows built-in proxy settings for instance
  TRestHttpClient = TRestHttpClientWinHttp;

  /// HTTP/HTTPS RESTful JSON default mORMot Client class is WinHttp on Windows
  TRestHttpsClient = TRestHttpClientWinHttp;

  {$else}

  /// HTTP/1.1 RESTful JSON default mORMot Client class uses sockets on POSIX
  TRestHttpClient = TRestHttpClientSocket;

Now, unlike before, this definition is used as a standard:

TRestHttpClient = TRestHttpClientSocket;

I find this change a little unfortunate. It was a change from the previous behavior. I would expect them to be more centralized in Unit mormot.defines.inc.

With best regards
Thomas

Last edited by tbo (2022-07-06 10:21:52)

Offline

#4 2022-07-07 07:23:12

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

Re: Changes break source code

You can still use directly TRestHttpClientWinHttp in your code, and have the expected callbacks.

Offline

Board footer

Powered by FluxBB