#1 2023-10-05 12:05:45

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

function HttpGet parameter naming

I would call the naming of parameters "forceSocket" and "forceNotSocket" unfortunate. Maybe I'm the only one who had to look twice until I understood the source code.

/// retrieve the content of a web page, using the HTTP/1.1 protocol and GET method
// - this method will use a low-level THttpClientSock socket for plain http URI,
// or TWinHttp/TCurlHttp for any https URI
function HttpGet(const aUri: RawUtf8; const inHeaders: RawUtf8;
  outHeaders: PRawUtf8 = nil; forceNotSocket: boolean = false;
  outStatus: PInteger = nil; timeout: integer = 0; forceSocket: boolean = false;
  ignoreTlsCertError: boolean = false): RawByteString; overload;

With best regards
Thomas

Offline

#2 2023-10-06 08:54:39

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

Re: function HttpGet parameter naming

You are perfectly right: this function parameters are clearly foobar.

This is a "legacy" from mORMot 1 weird history.

What do you propose as changes?

Offline

Board footer

Powered by FluxBB