HTTP_FILTER_CONTEXT Structure
The HTTP_FILTER_CONTEXT structure has the following form:
typedef struct _HTTP_FILTER_CONTEXT
{
DWORD cbSize; //IN
DWORD Revision; //IN
PVOID ServerContext; //IN
DWORD ulReserved; //IN
BOOL fIsSecurePort; //IN
PVOID pFilterContext; //IN/OUT
BOOL (WINAPI * GetServerVariable) (
struct _HTTP_FILTER_CONTEXT * pfc,
LPSTR lpszVariableName,
LPVOID lpvBuffer,
LPDWORD lpdwSize
);
BOOL (WINAPI * AddResponseHeaders) (
struct _HTTP_FILTER_CONTEXT * pfc,
LPSTR lpszHeaders,
DWORD dwReserved
);
BOOL (WINAPI * WriteClient) (
struct _HTTP_FILTER_CONTEXT * pfc,
LPVOID Buffer,
LPDWORD lpdwBytes,
DWORD dwReserved
);
VOID * (WINAPI * AllocMem) (
struct _HTTP_FILTER_CONTEXT * pfc,
DWORD cbSize,
DWORD dwReserved
);
BOOL (WINAPI * ServerSupportFunction) (
struct _HTTP_FILTER_CONTEXT * pfc,
enum SF_REQ_TYPE sfReq,
PVOID pData,
DWORD ul1,
DWORD ul2
);
} HTTP_FILTER_CONTEXT, *PHTTP_FILTER_CONTEXT;
The references to IN or IN/OUT above indicate whether the member applies to messages to the filter (IN) or both to and from the filter (IN/OUT).
Members
cbSize
Size of this structure, in bytes.
Revision
Revision level of this structure. Less than or equal to the version of the HTTP_FILTER_REVISION.
ServerContext
Reserved for server use.
ulReserved
Reserved for server use.
fIsSecurePort
TRUE indicates that this event is occurring over a secure port.
pFilterContext
A pointer to be used by the filter for any context information that the filter wants to associate with this request. Any memory associated with this request can be safely freed during the SF_NOTIFY_END_OF_NET_SESSION notification.
GetServerVariable
Pointer to a function to retrieve information about the server and this connection. See CHttpServerContext::GetServerVariable for details. GetServerVariable takes the following parameters:
pfc Pointer to a filter context passed to CHttpFilter::HttpFilterProc.
lpszVariableName Server variable to retrieve.
lpvBuffer Buffer to store value of variable.
lpdwSize Size of buffer lpvBuffer.
AddResponseHeaders
Pointer to a function that adds a header to the HTTP response. See the description of HSE_REQ_SEND_RESPONSE_HEADER at CHttpServerContext::ServerSupportFunction for details. AddResponseHeaders takes the following parameters:
pfc Pointer to a filter context passed to CHttpFilter::HttpFilterProc.
lpszHeaders Pointer string containing headers to add.
dwReserved Reserved for future use. Must be 0.
WriteClient
Pointer to a function that sends raw data back to the client. See CHttpFilterContext::WriteClient for details. WriteClient takes the following parameters:
pfc Pointer passed to CHttpFilter::HttpFilterProc.
Buffer Buffer containing data to send to the client.
lpdwBytes Size of the buffer pointed to by Buffer.
dwReserved Reserved for future use.
AllocMem
Pointer to a function used to allocate memory. Any memory allocated with this function will automatically be freed when the request is completed. AllocMem takes the following parameters:
pfc Pointer passed to CHttpFilter::HttpFilterProc.
cbSize Size of the buffer to allocate.
dwReserved Reserved for future use.
ServerSupportFunction
Pointer to a function used to extend the ISAPI filter APIs. Parameters, listed below, are specific to the ISA used.
pfc Pointer to a function used to extend the ISAPI filter APIs.
sfReq Server function notification. Possible values:
SF_REQ_SEND_RESPONSE_HEADER Sends a complete HTTP server response header including the status, server version, message time and MIME version. Server extensions should append other information at the end, such as Content-type, Content-length, and so forth, followed by an extra '\r\n'.
SF_REQ_ADD_HEADERS_ON_DENIAL If the server denies the HTTP request, add the specified headers to the server error response. This allows an authentication filter to advertise its services without filtering every request. Generally the headers will be WWW-Authenticate headers with custom authentication schemes, but no restriction is placed on what headers may be specified.
SF_REQ_SET_NEXT_READ_SIZE Only used by raw data filters that return SF_STATUS_READ_NEXT.
pData Pointer to a string. Specific to the ISA. See the table under the Comments section for the appropriate values for each sfReq value.
ul1, ul2 Specific to the ISA. See the table under the Comments section for the appropriate values for each sfReq value.
Comments
Below are the corresponding possible values for the ServerSupportFunction parameters:
sfReq | pData | ul1, ul2 |
SF_REQ_SEND_RESPONSE_HEADER | Zero-terminated string pointing to optional status string (i.e., "401 Access Denied") or NULL for the default response of "200 OK". | Zero-terminated string pointing to optional data to be appended and set with the header. If NULL, the header will be terminated with an empty line. |
SF_REQ_ADD_HEADERS_ON_DENIAL | Zero-terminated string pointing to one or more header lines with terminating '\r\n'. | |
SF_REQ_SET_NEXT_READ_SIZE | Size in bytes for the next read. |
See AlsoCHttpFilter::HttpFilterProc, CHttpFilter::OnLog, CHttpServerContext, CHttpServerContext::GetServerVariable, CHttpServerContext::ServerSupportFunction, CHttpServerContext::WriteClient