HttpFilterProc

The HttpFilterProc records notification of events from the server.

DWORD WINAPI HttpFilterProc(

    PHTTP_FILTER_CONTEXT pfc,

 

    DWORD notificationType,

 

    LPVOID pvNotification

 

   );

 

 

Parameters

pfc

The HTTP_FILTER_CONTEXT structure pointed to by this parameter contains context information. The pFilterContext member can be used by the filter to associate any context information with the HTTP request. The SF_NOTIFY_END_OF_NET_SESSION notification can be used to release any such context information.

notificationType

This indicates the type of event being processed. Valid types are:

SF_NOTIFY_SECURE_PORT

Notify application only for sessions over a secure port.

SF_NOTIFY_NONSECURE_PORT

Notify application only for sessions over a nonsecure port.

SF_NOTIFY_READ_RAW_DATA

Allow the application to see the raw data. The data returned will contain both headers and data.

SF_NOTIFY_PREPROC_HEADERS

The server has preprocessed the headers.

SF_NOTIFY_AUTHENTICATION

The server is authenticating the client.

SF_NOTIFY_URL_MAP

The server is mapping a logical URL to a physical path.

SF_NOTIFY_SEND_RAW_DATA

The server is sending raw data back to the client.

SF_NOTIFY_LOG

The server is writing information to the server log.

SF_NOTIFY_END_OF_NET_SESSION

The session with the client is ending.

SF_NOTIFY_ACCESS_DENIED

Allows an ISAPI Filter to be notified any time the server is about to return a "401 Access Denied".  This lets the Filter analyze the failure and return a custom message.

 

pvNotification

The notification-specific structure.

Notification Type

pvNotification points to

SF_NOTIFY_READ_RAW_DATA

HTTP_FILTER_RAW_DATA

SF_NOTIFY_SEND_RAW_DATA

HTTP_FILTER_RAW_DATA

SF_NOTIFY_PREPROC_HEADERS

HTTP_FILTER_PREPROC_HEADERS

SF_NOTIFY_AUTHENTICATION

HTTP_FILTER_AUTHENT

SF_NOTIFY_URL_MAP

HTTP_FILTER_URL_MAP

SF_NOTIFY_LOG

HTTP_FILTER_LOG

SF_NOTIFY_ACCESS_DENIED

HTTP_FILTER_ACCESS_DENIED

 

Return Values

The return codes indicate how the application handled the event. Possible return codes are:

SF_STATUS_REQ_FINISHED

The filter has handled the HTTP request. The server should disconnect the session.

SF_STATUS_REQ_FINISHED_KEEP_CONN

This is the same as SF_STATUS_REQ_FINISHED, except that the server should keep the TCP session open if the option was negotiated.

SF_STATUS_REQ_NEXT_NOTIFICATION

The next filter in the notification chain should be called.

SF_STATUS_REQ_HANDLED_NOTIFICATION

This filter handled the notification. No other handlers should be called for this particular notification type.

SF_STATUS_REQ_ERROR

An error occurred. The server should call GetLastError and indicate the error to the client.

SF_STATUS_REQ_READ_NEXT

The filter is an opaque stream filter and the session parameters are being negotiated. This is valid only for raw-read notification.

Remarks

This is where the core work of the ISAPI filter applications is done. The various structures pointed to by pvNotification contain data and function pointers specific to these operations. See the structure details for more information.

 

Note  Every filter is contained in a separate DLL with two common entry points: GetFilterVersion7D04FX and HttpFilterProcZ5JCLU. When the DLL is loaded, GetFilterVersion is called. This lets the filter know the server version and also lets the filter tell the server the filter version and the events that the filter is interested in.

After this, the server calls the filter's HttpFilterProc entry point with appropriate notifications. Note that filters should only register for notifications the filter needs to see   some filter notifications are very expensive in terms of CPU resources and I/O throughput, and can have a significant effect on the speed and scalability of the Microsoft Internet Server.

BOOL WINAPI GetFilterVersion(
    HTTP_FILTER_VERSION *pVer
   );

DWORD WINAPI HttpFilterProc(
    HTTP_FILTER_CONTEXT *pfc,
    DWORD notificationType,
    VOID *pvNotification
   );

See Also

HTTP_FILTER_CONTEXT, HTTP_FILTER_RAW_DATA, HTTP_FILTER_PREPROC_HEADERS, HTTP_FILTER_AUTHENT, HTTP_FILTER_URL_MAP, HTTP_FILTER_LOG