mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 16:49:20 +02:00
* Logging in request
git-svn-id: trunk@17505 -
This commit is contained in:
parent
96dedbdd4d
commit
d5e6d79b06
@ -49,8 +49,10 @@ Type
|
|||||||
FRequestID : Word;
|
FRequestID : Word;
|
||||||
FCGIParams : TSTrings;
|
FCGIParams : TSTrings;
|
||||||
FUR: TUnknownRecordEvent;
|
FUR: TUnknownRecordEvent;
|
||||||
|
FLog : TLogEvent;
|
||||||
procedure GetNameValuePairsFromContentRecord(const ARecord : PFCGI_ContentRecord; NameValueList : TStrings);
|
procedure GetNameValuePairsFromContentRecord(const ARecord : PFCGI_ContentRecord; NameValueList : TStrings);
|
||||||
Protected
|
Protected
|
||||||
|
Procedure Log(EventType : TEventType; Const Msg : String);
|
||||||
Function GetFieldValue(Index : Integer) : String; override;
|
Function GetFieldValue(Index : Integer) : String; override;
|
||||||
procedure ReadContent; override;
|
procedure ReadContent; override;
|
||||||
Public
|
Public
|
||||||
@ -68,8 +70,8 @@ Type
|
|||||||
TFCGIResponse = Class(TCGIResponse)
|
TFCGIResponse = Class(TCGIResponse)
|
||||||
private
|
private
|
||||||
FPO: TProtoColOptions;
|
FPO: TProtoColOptions;
|
||||||
procedure Write_FCGIRecord(ARecord : PFCGI_Header);
|
|
||||||
Protected
|
Protected
|
||||||
|
procedure Write_FCGIRecord(ARecord : PFCGI_Header); virtual;
|
||||||
Procedure DoSendHeaders(Headers : TStrings); override;
|
Procedure DoSendHeaders(Headers : TStrings); override;
|
||||||
Procedure DoSendContent; override;
|
Procedure DoSendContent; override;
|
||||||
Property ProtocolOptions : TProtoColOptions Read FPO Write FPO;
|
Property ProtocolOptions : TProtoColOptions Read FPO Write FPO;
|
||||||
@ -178,7 +180,10 @@ var cl,rcl : Integer;
|
|||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
case AFCGIRecord^.reqtype of
|
case AFCGIRecord^.reqtype of
|
||||||
FCGI_BEGIN_REQUEST : FKeepConnectionAfterRequest := (PFCGI_BeginRequestRecord(AFCGIRecord)^.body.flags and FCGI_KEEP_CONN) = FCGI_KEEP_CONN;
|
FCGI_BEGIN_REQUEST :
|
||||||
|
begin
|
||||||
|
FKeepConnectionAfterRequest := (PFCGI_BeginRequestRecord(AFCGIRecord)^.body.flags and FCGI_KEEP_CONN) = FCGI_KEEP_CONN;
|
||||||
|
end;
|
||||||
FCGI_PARAMS : begin
|
FCGI_PARAMS : begin
|
||||||
if AFCGIRecord^.contentLength=0 then
|
if AFCGIRecord^.contentLength=0 then
|
||||||
Result := False
|
Result := False
|
||||||
@ -259,6 +264,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TFCGIRequest.Log(EventType: TEventType; const Msg: String);
|
||||||
|
begin
|
||||||
|
If Assigned(FLog) then
|
||||||
|
FLog(EventType,Msg);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
Function TFCGIRequest.GetFieldValue(Index : Integer) : String;
|
Function TFCGIRequest.GetFieldValue(Index : Integer) : String;
|
||||||
|
|
||||||
@ -660,6 +671,7 @@ begin
|
|||||||
ATempRequest.Handle:=FHandle;
|
ATempRequest.Handle:=FHandle;
|
||||||
ATempRequest.ProtocolOptions:=Self.Protocoloptions;
|
ATempRequest.ProtocolOptions:=Self.Protocoloptions;
|
||||||
ATempRequest.OnUnknownRecord:=Self.OnUnknownRecord;
|
ATempRequest.OnUnknownRecord:=Self.OnUnknownRecord;
|
||||||
|
ATempRequest.FLog:=@Log;
|
||||||
FRequestsArray[ARequestID].Request := ATempRequest;
|
FRequestsArray[ARequestID].Request := ATempRequest;
|
||||||
end;
|
end;
|
||||||
if (ARequestID>FRequestsAvail) then
|
if (ARequestID>FRequestsAvail) then
|
||||||
@ -684,6 +696,8 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
|
AResponse:=Nil;
|
||||||
|
ARequest:=Nil;
|
||||||
if Socket=0 then
|
if Socket=0 then
|
||||||
if Port<>0 then
|
if Port<>0 then
|
||||||
SetupSocket(FIAddress,FAddressLength)
|
SetupSocket(FIAddress,FAddressLength)
|
||||||
@ -706,7 +720,6 @@ begin
|
|||||||
OnIdle(Self);
|
OnIdle(Self);
|
||||||
end;
|
end;
|
||||||
AFCGI_Record:=Read_FCGIRecord;
|
AFCGI_Record:=Read_FCGIRecord;
|
||||||
|
|
||||||
if assigned(AFCGI_Record) then
|
if assigned(AFCGI_Record) then
|
||||||
try
|
try
|
||||||
Result:=ProcessRecord(AFCGI_Record,ARequest,AResponse);
|
Result:=ProcessRecord(AFCGI_Record,ARequest,AResponse);
|
||||||
|
Loading…
Reference in New Issue
Block a user