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:

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:

WriteClient

Pointer to a function that sends raw data back to the client. See CHttpFilterContext::WriteClient for details. WriteClient takes the following parameters:

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:

ServerSupportFunction

Pointer to a function used to extend the ISAPI filter APIs. Parameters, listed below, are specific to the ISA used.

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 Also CHttpFilter::HttpFilterProc, CHttpFilter::OnLog, CHttpServerContext, CHttpServerContext::GetServerVariable, CHttpServerContext::ServerSupportFunction, CHttpServerContext::WriteClient