Marcos Douglas wrote 13 lines
On Tue, Apr 26, 2016 at 3:39 AM, Michael Van Canneyt
wrote:
> Well, time is of course an issue, but more importantly, I do not have ISS to
> test with.
>
> I think that PATHINFO needs to be corrected in custcgi.pp:
>
> Procedure TCGIRequest.InitFromEnvironment:
>
> Something like If Pos('IIS', ServerName)>0 then
> // Cut binary name from PathInfo
>
> It will then also be fixed for FastCGI as it reuses this routine.
Hi Michael,
Using the original sources of version 2.6.5 I can get the SERVER_SOFTWARE=Microsoft-IIS/10.0
So, I replaced the fcl-web package, version 2.6.5 to use 3.1.1. But in this last version SERVER_SOFTWARE is empty. I don't know why.
Look the code below.
===BEGIN===
procedure TCGIRequest.InitFromEnvironment;
Var
I : Integer;
R,V,OV : String;
M : TMap;
begin
For I:=1 to CGIVarCount do
begin
V:=GetEnvironmentVariable(CGIVarNames[I]);
if (V'') then
begin
M:=MapCgiToHTTP[i];
if M.HhhUnknown then
SetHeader(M.H,HTTPDecode(V))
else if M.VhvUnknown then
begin
if M.VhvQuery then
V:=HTTPDecode(V);
SetHTTPVariable(M.V,V)
end;
end;
end;
//---------------------
if Pos('IIS', ServerSoftware) > 0 then
PathInfo := StringReplace(PathInfo, ScriptName, '', []);
//---------------------
R:=UpCase(Method);
if (R='POST') or (R='PUT') or (ContentLength>0) then
ReadContent;
end;
===END===
Only these lines are new:
if Pos('IIS', ServerSoftware) > 0 then
PathInfo := StringReplace(PathInfo, ScriptName, '', []);
Nothing happens, because ServerSoftware is empty.
If I comment the first line, the PathInfo will be fixed but I got this error: "Could not determine HTTP module for request "list""
Consider this:
1- PathInfo and ScriptName are properties of THTTPHeader class 2- ServerSoftware is a property of TCGIRequest
So, on this version you check: M.HhhUnknown or M.VhvUnknown, then I'd tryed to implement:
[unit custcgi, line 166, const MapCgiToHTTP]
{ 17: 'SERVER_SOFTWARE' } (h:hhUnknown; v : hvServerSoftware),
...and added in httpdefs.THTTPVariableType too
...and I'd implemented this property too:
THTTPReader
Property ServerSoftware : String Index Ord(hvServerSoftware) read
GetHTTPVariable Write SetHTTPVariable;
Does't work.
So, now I have 2 problems:
1- If I change the PathInfo without check ServerName, I can fix it but the app raise an exception;
2- ServerSoftware doesn't work in version 3.1.1 .
Regards,
Marcos Douglas