Skip to content

Commit

Permalink
added GetSystemProxy() function
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud Bouchez committed Jan 25, 2024
1 parent c5c39b7 commit d55d7c6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/core/mormot.core.log.pas
Original file line number Diff line number Diff line change
Expand Up @@ -907,10 +907,10 @@ TSynLogFamily = class
// be restarted from scratch when it reaches RotateFileSizeKB size or when
// RotateFileDailyAtHour time is reached
// - if set to a number > 1, some rotated files will be compressed using the
// LogCompressAlgo algorithm (i.e. AlgoSynLZ by default), and will be named
// e.g. as MainLogFileName.0.synlz .. MainLogFileName.7.synlz for
// RotateFileCount=9 (total count = 9, including 1 main log file and
// 8 .synlz files)
// LogCompressAlgo algorithm (i.e. AlgoSynLZ by default but consider AlgoGZFast
// from mormot.core.zip to generate .gz files), and will be named e.g. as
// <MainLogFileName>.0.synlz .. <MainLogFileName>.7.synlz for RotateFileCount
// as 9 (i.e. total count = 9, including 1 main log file and 8 .synlz files)
property RotateFileCount: cardinal
read fRotateFileCount write fRotateFileCount;
/// maximum size of auto-rotated logging files, in kilo-bytes (per 1024 bytes)
Expand Down
2 changes: 1 addition & 1 deletion src/mormot.commit.inc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
'2.2.6851'
'2.2.6852'
19 changes: 16 additions & 3 deletions src/net/mormot.net.client.pas
Original file line number Diff line number Diff line change
Expand Up @@ -562,13 +562,18 @@ function WGet(const url: RawUtf8; const destfile: TFileName;


/// ask the Operating System to return the Tunnel/Proxy settings for a given URI
// - as used by OpenHttp/OpenHttpGet and TSimpleHttpClient
// - as used internally by OpenHttp/OpenHttpGet and TSimpleHttpClient to call
// THttpClientSocket.Open() constructor
// - if proxy is set, will return its value from @temp, otherwise return
// @DefaultHttpClientSocketProxy or call
// GetProxyForUri(DefaultHttpClientSocketProxyAuto) to fill and return @temp
// @DefaultHttpClientSocketProxy or call GetProxyForUri() to fill and return @temp
// - return nil if no proxy is to be used for this URI
function GetSystemProxyUri(const uri, proxy: RawUtf8; var temp: TUri): PUri;

/// ask the Operating System to return the Tunnel/Proxy settings for a given URI
// - return DefaultHttpClientSocketProxy.URI or call GetProxyForUri()
// - return '' if no proxy is to be used for this URI
function GetSystemProxy(const uri: RawUtf8): RawUtf8;

/// ask the Operating System to return the Tunnel/Proxy setting for a given URI
// - will always use or HTTP_PROXY/HTTPS_PROXY environment variables
// - if no environment variable is set, on Windows fromSystem=true will call
Expand Down Expand Up @@ -1565,6 +1570,14 @@ function GetSystemProxyUri(const uri, proxy: RawUtf8; var temp: TUri): PUri;
result := nil;
end;

function GetSystemProxy(const uri: RawUtf8): RawUtf8;
begin
if DefaultHttpClientSocketProxy.Server <> '' then
result := DefaultHttpClientSocketProxy.URI
else
result := GetProxyForUri(uri, DefaultHttpClientSocketProxyAuto);
end;

function ExtractResourceName(const uri: RawUtf8; sanitize: boolean): RawUtf8;
var
u: TUri;
Expand Down
4 changes: 2 additions & 2 deletions test/test.soa.network.pas
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,8 @@ procedure TTestBidirectionalRemoteConnection.SoaCallbackOnServerSide;
TestRest(fServer);
end;

function TTestBidirectionalRemoteConnection.NewClient(const port: RawUtf8):
TRestHttpClientWebsockets;
function TTestBidirectionalRemoteConnection.NewClient(
const port: RawUtf8): TRestHttpClientWebsockets;
begin
result := TRestHttpClientWebsockets.Create(
'127.0.0.1', port, TOrmModel.Create(fServer.Model));
Expand Down

0 comments on commit d55d7c6

Please sign in to comment.