* Fixed case where connection is closed gracefully (Bug ID 23386)

git-svn-id: trunk@23403 -
This commit is contained in:
michael 2013-01-16 10:57:47 +00:00
parent 2b300ec2b4
commit cce67cf5ae

View File

@ -962,32 +962,37 @@ begin
SetupSocket(FIAddress,FAddressLength)
else
Socket:=StdInputHandle;
if FHandle=THandle(-1) then
FHandle:=AcceptConnection;
if FHandle=THandle(-1) then
begin
if not terminated then
Repeat
if FHandle=THandle(-1) then
FHandle:=AcceptConnection;
if FHandle=THandle(-1) then
begin
Terminate;
raise Exception.CreateFmt(SNoInputHandle,[socketerror]);
end
end;
repeat
If (poUseSelect in ProtocolOptions) then
begin
While Not DataAvailable do
If (OnIdle<>Nil) then
OnIdle(Self);
if not terminated then
begin
Terminate;
raise Exception.CreateFmt(SNoInputHandle,[socketerror]);
end
end;
AFCGI_Record:=Read_FCGIRecord;
if assigned(AFCGI_Record) then
try
Result:=ProcessRecord(AFCGI_Record,ARequest,AResponse);
Finally
FreeMem(AFCGI_Record);
AFCGI_Record:=Nil;
end;
until Result;
repeat
If (poUseSelect in ProtocolOptions) then
begin
While Not DataAvailable do
If (OnIdle<>Nil) then
OnIdle(Self);
end;
AFCGI_Record:=Read_FCGIRecord;
// If connection closed gracefully, we have nil.
if Not Assigned(AFCGI_Record) then
CloseConnection
else
try
Result:=ProcessRecord(AFCGI_Record,ARequest,AResponse);
Finally
FreeMem(AFCGI_Record);
AFCGI_Record:=Nil;
end;
until Result or (FHandle=THandle(-1));
Until Result;
end;
{ TCustomFCgiApplication }