On Fri, 17 Feb 2012, michael.vancann...@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:m...@this.spot
That should be checked.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to