[fpc-pascal] fphttpclient get an url with colon

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Fri Feb 17 09:15:04 CET 2012



On Fri, 17 Feb 2012, michael.vancanneyt at wisa.be wrote:

>
>
> On Fri, 17 Feb 2012, Mattias Gaertner wrote:
>
>> Hi,
>> 
>> When I use TFPHTTPClient to fetch a page with a colon in the file name
>> it appends a slash "/". For example:
>>
>>  Client:=TFPHTTPClient.Create(nil);
>>  Response:=TMemoryStream.Create;
>>  Client.Get('http://wiki.lazarus.freepascal.org/Image:Acs_demos.jpg',Response);
>> 
>> It fetches "/Image:Acs_demos.jpg/".
>> 
>> The / is appended in ParseURI when extracting the document name. For
>> some reason it stops at a colon:
>>
>>  // now s is 'hier-part' per RFC3986
>>  // Extract the document name (nasty...)
>>
>>  for i := Length(s) downto 1 do
>>    if s[i] = '/' then
>>    begin
>>      ...
>>    end else if s[i] = ':' then
>>      break
>>    else
>>      ...
>> 
>> Why?
>
> Probably some misguided attempt at handling file:///c:/something
>
> You can remove that code.

Thinking about it, maybe it was designed to also handle mailto:me at this.spot
That should be checked.

Michael.



More information about the fpc-pascal mailing list