Skip to content

Commit 3cd74d9

Browse files
committed
fix:
- Corrigido AV não mostrando no cliente #117 - Correção preventiva de erros nos clientes na função tratarExcecao - Correção preventiva de erro em casos de Param Stream vazio feat: - Atualização de arquivo de fontes de identidade visual Fixed #117
1 parent e68d6db commit 3cd74d9

File tree

8 files changed

+25
-13
lines changed

8 files changed

+25
-13
lines changed
65.2 KB
Loading

Assets/src/PascalRAL Assets.fig

333 KB
Binary file not shown.

src/base/RALParams.pas

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,10 +421,14 @@ procedure TRALParam.SetAsStream(const AValue: TStream);
421421
if FContent <> nil then
422422
FreeAndNil(FContent);
423423

424-
AValue.Position := 0;
425-
426-
FContent := TRALStringStream.Create(AValue);
427-
FContent.Position := 0;
424+
if AValue <> nil then
425+
begin
426+
AValue.Position := 0;
427+
FContent := TRALStringStream.Create(AValue);
428+
FContent.Position := 0;
429+
end
430+
else
431+
FContent := nil;
428432
end;
429433

430434
procedure TRALParam.SetAsString(const AValue: StringRAL);

src/base/RALServer.pas

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,10 +704,13 @@ procedure TRALServer.ProcessCommands(ARequest: TRALRequest; AResponse: TRALRespo
704704
end;
705705
except
706706
on e: exception do
707+
begin
707708
if assigned(OnServerError) then
708709
OnServerError(e)
709710
else if RaiseError then
710711
raise;
712+
AResponse.Answer(HTTP_InternalError, e.Message, rctTEXTPLAIN);
713+
end;
711714
end;
712715
end;
713716

src/engine/indy/RALIndyClient.pas

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,14 @@ procedure TRALIndyClientHTTP.SendUrl(AURL: StringRAL; ARequest: TRALRequest;
6262
vCookies: TStringList;
6363
vInt: IntegerRAL;
6464

65-
procedure tratarExcecao(ACode : IntegerRAL; AMessage : StringRAL);
65+
procedure tratarExcecao(ACode: IntegerRAL; AMessage: StringRAL);
6666
begin
6767
AResponse.Params.CompressType := ctNone;
6868
AResponse.Params.CriptoOptions.CriptType := crNone;
69-
AResponse.StatusCode := FHttp.ResponseCode;
69+
if assigned(FHttp) then
70+
AResponse.StatusCode := FHttp.ResponseCode
71+
else
72+
AResponse.StatusCode := ACode;
7073
AResponse.ResponseText := AMessage;
7174
AResponse.ErrorCode := ACode;
7275
end;
@@ -165,13 +168,13 @@ procedure TRALIndyClientHTTP.SendUrl(AURL: StringRAL; ARequest: TRALRequest;
165168
AResponse.StatusCode := FHttp.ResponseCode;
166169
AResponse.ResponseStream := vResult;
167170
except
168-
on e : EIdSocketError do
171+
on e: EIdSocketError do
169172
tratarExcecao(e.LastError, e.Message);
170-
on e : EIdConnectTimeout do
173+
on e: EIdConnectTimeout do
171174
tratarExcecao(10060, e.Message);
172-
on e : EIdReadTimeout do
175+
on e: EIdReadTimeout do
173176
tratarExcecao(10060, e.Message);
174-
on e : Exception do
177+
on e: Exception do
175178
tratarExcecao(-1, e.Message);
176179
end;
177180
finally

src/engine/netHTTP/RALnetHTTPClient.pas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ procedure TRALnetHTTPClientHTTP.SendUrl(AURL: StringRAL; ARequest: TRALRequest;
184184
AResponse.ResponseStream := vResponse.ContentStream;
185185
end;
186186
except
187-
on e : ENetHTTPClientException do begin
187+
on e: ENetHTTPClientException do begin
188188
vErroCode := -1;
189189
if Pos('12029', e.Message) > 0 then
190190
vErroCode := 12029
@@ -193,7 +193,7 @@ procedure TRALnetHTTPClientHTTP.SendUrl(AURL: StringRAL; ARequest: TRALRequest;
193193

194194
tratarExcecao(vErroCode, e.Message);
195195
end;
196-
on e : Exception do
196+
on e: Exception do
197197
tratarExcecao(-1, e.Message);
198198
end;
199199
finally

src/engine/synopse/RALSynopseClient.pas

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ procedure TRALSynopseClientHTTP.SendUrl(AURL: StringRAL; ARequest: TRALRequest;
3838
vCookies: TStringList;
3939
vInt: IntegerRAL;
4040

41-
procedure tratarExcecao(ACode : IntegerRAL; AMessage : StringRAL);
41+
procedure tratarExcecao(ACode: IntegerRAL; AMessage: StringRAL);
4242
begin
4343
AResponse.Params.CompressType := ctNone;
4444
AResponse.Params.CriptoOptions.CriptType := crNone;
4545
AResponse.ResponseText := AMessage;
4646
AResponse.ErrorCode := ACode;
47+
AResponse.StatusCode := ACode;
4748
end;
4849

4950
begin

src/engine/synopse/RALSynopseServer.pas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ function TRALSynopseServer.OnCommandProcess(AContext: THttpServerRequestAbstract
274274
end;
275275

276276
ProcessCommands(vRequest, vResponse);
277+
277278
with vResponse do
278279
begin
279280
AContext.OutContent := ResponseText;

0 commit comments

Comments
 (0)