📄 dxisapi.pas
字号:
TDXISAPI = class(TDXComponent)
private
fGetServerVariable:TDX_GetServerVariable;
fRedirectHeader:TDX_RedirectHeader;
fBuildHeader:TDX_BuildHeader;
fTimeout:Integer;
// fCertificate:TCERT_CONTEXT_EX;
protected
Procedure RegisterFilters(var ResultLog:String);
Procedure UnRegisterFilters(var ResultLog:String);
Procedure SetServerVariableProc(value:TFilterGetServerVariableProc);
Function GetServerVariableProc:TFilterGetServerVariableProc;
public
//////////////////////////////
// Server Event Procedure
// Not of use to end-user.
//////////////////////////////
Procedure ServerStartEvent;
Procedure ServerStopEvent;
Procedure ServerRawRead(ReadString:String;Len:Longword);
Procedure ServerPreprocHeaderEvent(DXHeaderInfo:PHeaderInfo);
Procedure ConvertedURL2Physical(URL:String;Physical:String);
//////////////////////////////
// there are more to be added between converted and end of request in 2.4
//////////////////////////////
Procedure ServerEndOfRequest;
Procedure ServerEndSession;
public
constructor Create(AOwner:TComponent); {$IFNDEF OBJECTS_ONLY} override; {$ENDIF}
Destructor Destroy; override;
Function Execute(Session:TDXClientThread;ISAPI,Method,QueryString,
PathInfo,PathTranslated,POSTContent_Type,POSTData:String;
POSTDataSize:Integer;Var ResultLog:String):Boolean;
Function RegisterDLL(ISAPI:String):Boolean;
Function UnRegisterDLL(ISAPI:String):Boolean;
Function AddFilter(ISAPI:String):Boolean;
Function RemoveFilter(ISAPI:String):Boolean;
Function FilterCount:Integer;
published
Property GetVariable:TDX_GetServerVariable read fGetServerVariable
write fGetServerVariable;
Property GetVariableFilter:TFilterGetServerVariableProc read GetServerVariableProc
write SetServerVariableProc;
Property NeedHeaderForRedirect:TDX_RedirectHeader read fRedirectHeader
write fRedirectHeader;
Property NeedHeader:TDX_BuildHeader read fBuildHeader
write fBuildHeader;
Property ReadSocketTimeout:Integer read fTimeout
write fTimeout;
end;
Implementation
Uses
{$IFDEF LINUX}
Libc,
{$ENDIF}
SysUtils, {StrPCopy}
DXHTTPServerCore;
Const
{from Microsoft's .h files for ISAPI!}
HSE_VERSION_MAJOR=6;
HSE_VERSION_MINOR=0;
HSE_VERSION=$0600;
HSE_REQ_END_RESERVED=1000;
///////////////////////////////////////////////////////////////////////////////
// MSDN:
// The extension has finished processing and the server should disconnect the
// client and free up allocated resources.
///////////////////////////////////////////////////////////////////////////////
HSE_STATUS_SUCCESS=1;
///////////////////////////////////////////////////////////////////////////////
// MSDN:
// The extension has finished processing and the server should wait for the next
// HTTP request if the client supports Keep-Alive connections. The extension
// can return this only if it was able to send the correct Content-Length header
// to the client.
///////////////////////////////////////////////////////////////////////////////
HSE_STATUS_SUCCESS_AND_KEEP_CONN=2;
///////////////////////////////////////////////////////////////////////////////
// MSDN:
// The extension has queued the request for processing and will notify the
// server when it has finished. See HSE_REQ_DONE_WITH_SESSION under
// ServerSupportFunction.
///////////////////////////////////////////////////////////////////////////////
HSE_STATUS_PENDING=3;
///////////////////////////////////////////////////////////////////////////////
// MSDN:
// The extension has encountered an error while processing the request, so the
// server can disconnect the client and free up allocated resources. An HTTP
// status code of 500 is written to the IIS log for the request.
///////////////////////////////////////////////////////////////////////////////
HSE_STATUS_ERROR=4;
// The following are the values to request services with the
// ServerSupportFunction().
// Values from 0 to 1000 are reserved for future versions of the interface
HSE_REQ_BASE=0;
///////////////////////////////////////////////////////////////////////////////
// MSDN:
// This support function allows your ISAPI extension to redirect a client
// browser to a different URL from the one they initially requested. When this
// support function is called, you must provide the new URL. IIS then sends the
// HTTP status code 302 (URL Redirect) to the client browser.
///////////////////////////////////////////////////////////////////////////////
HSE_REQ_SEND_URL_REDIRECT_RESP=( HSE_REQ_BASE + 1 ); // ISAPI 2.0/3.0
HSE_REQ_SEND_URL=( HSE_REQ_BASE + 2 ); // ISAPI 2.0/3.0
///////////////////////////////////////////////////////////////////////////////
// MSDN:
// This support function allows you to request that IIS send a complete HTTP
// response header to the client browser, including the HTTP status, server
// version, message time, and MIME version. Your extension can also, optionally,
// append other header information to the end of IIS-generated header, such as
// Content-Type or Content-Length.
///////////////////////////////////////////////////////////////////////////////
HSE_REQ_SEND_RESPONSE_HEADER=( HSE_REQ_BASE + 3 ); // ISAPI 2.0/3.0 // depreciated
HSE_REQ_SEND_RESPONSE_HEADER_EX=(HSE_REQ_END_RESERVED+16); // ISAPI 2.0/3.0
///////////////////////////////////////////////////////////////////////////////
// MSDN:
// If your extension is performing some form of extended processing, and its
// HttpExtensionProc entry-point function has returned the status code
// HSE_STATUS_PENDING, then your extension should notify IIS when all
// processing is complete by using this support function. Calling this function
// will terminate the session connection.
///////////////////////////////////////////////////////////////////////////////
HSE_REQ_DONE_WITH_SESSION=( HSE_REQ_BASE + 4 ); // ISAPI 2.0/3.0
// These are Microsoft specific extensions
///////////////////////////////////////////////////////////////////////////////
// MSDN:
// This support function allows your ISAPI extension to map a logical URL path
// to a physical path.
///////////////////////////////////////////////////////////////////////////////
HSE_REQ_MAP_URL_TO_PATH=(HSE_REQ_END_RESERVED+1); // ISAPI 2.0/3.0
HSE_REQ_MAP_URL_TO_PATH_EX=(HSE_REQ_END_RESERVED+12); // ISAPI 4.0
///////////////////////////////////////////////////////////////////////////////
// MSDN:
// This support function allows your ISAPI extension to retrieve context and
// credential handles to the CtxtHandle and CredHandle structures, as defined
// in the header file sspi.h. Once these handles are retrieved, they can be
// used to query or manipulate the server certificate information by using the
// standard certificate APIs that are also defined in sspi.h.
///////////////////////////////////////////////////////////////////////////////
HSE_REQ_GET_SSPI_INFO=(HSE_REQ_END_RESERVED+2); // ISAPI 2.0/3.0
///////////////////////////////////////////////////////////////////////////////
// MSDN:
// You can use this support function to write your own custom log strings to
// the log record. When this function is called, the string contained in the
// buffer you specify is appended to the log record for the current HTTP
// request.
///////////////////////////////////////////////////////////////////////////////
HSE_APPEND_LOG_PARAMETER=(HSE_REQ_END_RESERVED+3); // ISAPI 2.0/3.0
///////////////////////////////////////////////////////////////////////////////
// MSDN:
// Using this support function, you can set a special callback function that
// will be used for handling asynchronous I/O operations.
///////////////////////////////////////////////////////////////////////////////
HSE_REQ_IO_COMPLETION=(HSE_REQ_END_RESERVED+5); // ISAPI 2.0/3.0
///////////////////////////////////////////////////////////////////////////////
// MSDN:
// This support function enables your ISAPI extension to call the
// high-performance Win32
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -