Skip to content

Commit aa79c28

Browse files
authored
correção (#385)
2 parents c6044fc + 914bde7 commit aa79c28

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

CORE/Source/Basic/uRESTDWBasic.pas

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3418,8 +3418,13 @@ procedure TRESTClientPoolerBase.SetIpVersion(IpV: TRESTDWClientIpVersions);
34183418
vDataBuff := '';
34193419
vRequestHeader := TStringList.Create;
34203420
vCompareContext := False;
3421+
{ TODO 1 -oRoniery -ccorreção : função para fazer decode de url utf8 para ascii }
3422+
RawHTTPCommand := DecodeURL(RawHTTPCommand);
3423+
QueryParams := DecodeURL(QueryParams);
34213424
Cmd := RemoveBackslashCommands(Trim(RawHTTPCommand));
34223425
vUrlToExec := '';
3426+
3427+
34233428
Try
34243429
sCharSet := '';
34253430
If (UpperCase(Copy (Cmd, 1, 3)) = 'GET') Then

CORE/Source/utils/uRESTDWTools.pas

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,8 @@ interface
457457
Const CharSet : TCharSet) : Boolean;Overload;
458458
Procedure InitializeStrings;
459459

460+
function DecodeURL(const urlEncoded: string): string;
461+
460462
Implementation
461463

462464
Uses
@@ -4963,6 +4965,29 @@ function abbintohexstring(stream: Tstream):string;
49634965
{$ENDIF}
49644966
End;
49654967

4968+
function DecodeURL(const urlEncoded: string): string;
4969+
var
4970+
i: Integer;
4971+
hexValue: string;
4972+
begin
4973+
Result := '';
4974+
i := 1;
4975+
while i <= Length(urlEncoded) do
4976+
begin
4977+
if urlEncoded[i] = '%' then
4978+
begin
4979+
hexValue := Copy(urlEncoded, i + 1, 2);
4980+
Result := Result + Char(StrToInt('$' + hexValue));
4981+
Inc(i, 3);
4982+
end
4983+
else
4984+
begin
4985+
Result := Result + urlEncoded[i];
4986+
Inc(i);
4987+
end;
4988+
end;
4989+
end;
4990+
49664991
initialization
49674992
InitializeStrings;
49684993

0 commit comments

Comments
 (0)