mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-30 00:39:19 +02:00
+ UriParser.pp: Consider 'port' part present in authority only if colon is followed by all digits. Mantis #24302.
git-svn-id: trunk@24280 -
This commit is contained in:
parent
3e2cedaf59
commit
20ed97a1e2
@ -169,7 +169,8 @@ end;
|
||||
function ParseURI(const URI, DefaultProtocol: String; DefaultPort: Word;Decode : Boolean = True): TURI;
|
||||
var
|
||||
s, Authority: String;
|
||||
i: Integer;
|
||||
i,j: Integer;
|
||||
PortValid: Boolean;
|
||||
begin
|
||||
Result.Protocol := LowerCase(DefaultProtocol);
|
||||
Result.Port := DefaultPort;
|
||||
@ -267,8 +268,18 @@ begin
|
||||
i := LastDelimiter(':@', Authority);
|
||||
if (i > 0) and (Authority[i] = ':') then
|
||||
begin
|
||||
Result.Port := StrToInt(Copy(Authority, i + 1, MaxInt));
|
||||
Authority := Copy(Authority, 1, i - 1);
|
||||
PortValid := true;
|
||||
for j:=i+1 to Length(Authority) do
|
||||
if not (Authority[j] in ['0'..'9']) then
|
||||
begin
|
||||
PortValid := false;
|
||||
break;
|
||||
end;
|
||||
if PortValid then
|
||||
begin
|
||||
Result.Port := StrToInt(Copy(Authority, i + 1, MaxInt));
|
||||
Authority := Copy(Authority, 1, i - 1);
|
||||
end;
|
||||
end;
|
||||
|
||||
// Extract the hostname
|
||||
|
Loading…
Reference in New Issue
Block a user