Skip to content

Commit

Permalink
minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeus64 committed Nov 23, 2023
1 parent 6892474 commit 431ca6a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Source/Alcinoe.FMX.Objects.pas
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@ TALText = class(TControl)
property TextSettings: TTextSettings read fTextSettings write SetTextSettings;
property Visible default True;
property Width;
property MaxWidth: single read fMaxWidth write SetMaxWidth stored IsMaxWidthStored; // these properties are usefull when used
property MaxHeight: single read fMaxHeight write SetMaxHeight stored IsMaxHeightStored; // with autosize
property MaxWidth: single read fMaxWidth write SetMaxWidth stored IsMaxWidthStored; // These properties are useful
property MaxHeight: single read fMaxHeight write SetMaxHeight stored IsMaxHeightStored; // when used with autosize
{Drag and Drop events}
property OnDragEnter;
property OnDragLeave;
Expand Down
16 changes: 11 additions & 5 deletions Source/Alcinoe.HTTP.Client.Net.Pool.pas
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ procedure TALNetHttpClientPool.DoGet(var AExtData: Tobject);
Var LUri := Turi.Create(aUrl);
var LNetHttpClient := ALAcquireKeepAliveNetHttpClient(LUri);
try
//in case we cut the connection I already see this returning sucess with
//a partial content. What a sheet!!
// In case we lose the connection, this might return success with
// partial content. What a mess!
result := LNetHttpClient.Get(aUrl, LResponseContent);
finally
ALReleaseKeepAliveNetHttpClient(LUri, LNetHttpClient);
Expand Down Expand Up @@ -218,6 +218,15 @@ procedure TALNetHttpClientPool.DoGet(var AExtData: Tobject);
if (not assigned(RetrieveCachedData)) or
(not RetrieveCachedData(LNetHttpClientPoolRequest.Url, LHTTPResponse, LResponseContent)) then begin
LHTTPResponse := _HttpGetUrl(LNetHttpClientPoolRequest.Url, LResponseContent);
// Client error responses (400 – 499)
// Server error responses (500 – 599)
if (LHTTPResponse = nil) or
((LHTTPResponse.StatusCode >= 400) and (LHTTPResponse.StatusCode <= 599)) then begin
if assigned(LNetHttpClientPoolRequest.OnErrorCallBack) then
LNetHttpClientPoolRequest.OnErrorCallBack('HTTP request failed', LNetHttpClientPoolRequest.FExtData);
exit;
end;
ALDecompressHttpResponseContent(LHTTPResponse.ContentEncoding, LResponseContent);
if (assigned(CacheData)) then CacheData(LNetHttpClientPoolRequest.Url, LHTTPResponse, LResponseContent);
end;
end
Expand All @@ -226,9 +235,6 @@ procedure TALNetHttpClientPool.DoGet(var AExtData: Tobject);
else LResponseContent.LoadFromFile(LNetHttpClientPoolRequest.Url);
end;

//decode the result if necessary
if (LHTTPResponse <> nil) then ALDecompressHttpResponseContent(LHTTPResponse.ContentEncoding, LResponseContent);

//fire the OnSuccess
LNetHttpClientPoolRequest.OnSuccessCallBack(LHTTPResponse, LResponseContent, LNetHttpClientPoolRequest.FExtData);

Expand Down

0 comments on commit 431ca6a

Please sign in to comment.