[fpc-pascal] fpwebfile, indexPageName and query -> 404
Michael Van Canneyt
michael at freepascal.org
Tue Sep 13 16:40:58 CEST 2022
On Tue, 13 Sep 2022, Luca Olivetti via fpc-pascal wrote:
> El 13/9/22 a les 16:28, Michael Van Canneyt via fpc-pascal ha escrit:
>>
>>
>> On Tue, 13 Sep 2022, Luca Olivetti via fpc-pascal wrote:
>>
>>> Hello,
>>>
>>> if I request, e.g.
>>>
>>> http://localhost:8080 or http://localhost:8080/
>>>
>>> fpwebfile returns the document defined as IndexPageName (in my case
>>> index.html), but if I request
>>>
>>> http://localhost:8080?xxx or http://localhost:8080/?xxx
>>>
>>> I get a 404.
>>>
>>> That's because TCustomFileModule.GetRequestFIleName with an empty PathInfo
>>> uses the URI and thinks that the filename is ?xxx.
>>>
>>> Maybe the
>>>
>>> if (Result='') then
>>> Result:=ARequest.URI;
>>>
>>>
>>> should be eliminated?
>>
>> No, it needs to strip the query parameter.
>
> But that's already in PathInfo:
In the HTTP application, yes. In other hosting mechanisms maybe not.
When stripping the query param, the result should be empty anyway, and then
the default file mechanism will kick in.
Michael.
More information about the fpc-pascal
mailing list