Skip to content

Commit 431ca6a

Browse files
committed
minor update
1 parent 6892474 commit 431ca6a

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

Source/Alcinoe.FMX.Objects.pas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,8 @@ TALText = class(TControl)
370370
property TextSettings: TTextSettings read fTextSettings write SetTextSettings;
371371
property Visible default True;
372372
property Width;
373-
property MaxWidth: single read fMaxWidth write SetMaxWidth stored IsMaxWidthStored; // these properties are usefull when used
374-
property MaxHeight: single read fMaxHeight write SetMaxHeight stored IsMaxHeightStored; // with autosize
373+
property MaxWidth: single read fMaxWidth write SetMaxWidth stored IsMaxWidthStored; // These properties are useful
374+
property MaxHeight: single read fMaxHeight write SetMaxHeight stored IsMaxHeightStored; // when used with autosize
375375
{Drag and Drop events}
376376
property OnDragEnter;
377377
property OnDragLeave;

Source/Alcinoe.HTTP.Client.Net.Pool.pas

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ procedure TALNetHttpClientPool.DoGet(var AExtData: Tobject);
185185
Var LUri := Turi.Create(aUrl);
186186
var LNetHttpClient := ALAcquireKeepAliveNetHttpClient(LUri);
187187
try
188-
//in case we cut the connection I already see this returning sucess with
189-
//a partial content. What a sheet!!
188+
// In case we lose the connection, this might return success with
189+
// partial content. What a mess!
190190
result := LNetHttpClient.Get(aUrl, LResponseContent);
191191
finally
192192
ALReleaseKeepAliveNetHttpClient(LUri, LNetHttpClient);
@@ -218,6 +218,15 @@ procedure TALNetHttpClientPool.DoGet(var AExtData: Tobject);
218218
if (not assigned(RetrieveCachedData)) or
219219
(not RetrieveCachedData(LNetHttpClientPoolRequest.Url, LHTTPResponse, LResponseContent)) then begin
220220
LHTTPResponse := _HttpGetUrl(LNetHttpClientPoolRequest.Url, LResponseContent);
221+
// Client error responses (400 – 499)
222+
// Server error responses (500 – 599)
223+
if (LHTTPResponse = nil) or
224+
((LHTTPResponse.StatusCode >= 400) and (LHTTPResponse.StatusCode <= 599)) then begin
225+
if assigned(LNetHttpClientPoolRequest.OnErrorCallBack) then
226+
LNetHttpClientPoolRequest.OnErrorCallBack('HTTP request failed', LNetHttpClientPoolRequest.FExtData);
227+
exit;
228+
end;
229+
ALDecompressHttpResponseContent(LHTTPResponse.ContentEncoding, LResponseContent);
221230
if (assigned(CacheData)) then CacheData(LNetHttpClientPoolRequest.Url, LHTTPResponse, LResponseContent);
222231
end;
223232
end
@@ -226,9 +235,6 @@ procedure TALNetHttpClientPool.DoGet(var AExtData: Tobject);
226235
else LResponseContent.LoadFromFile(LNetHttpClientPoolRequest.Url);
227236
end;
228237

229-
//decode the result if necessary
230-
if (LHTTPResponse <> nil) then ALDecompressHttpResponseContent(LHTTPResponse.ContentEncoding, LResponseContent);
231-
232238
//fire the OnSuccess
233239
LNetHttpClientPoolRequest.OnSuccessCallBack(LHTTPResponse, LResponseContent, LNetHttpClientPoolRequest.FExtData);
234240

0 commit comments

Comments
 (0)