virtual DWORD OnLog( CHttpFilterContext* pfc, PHTTP_FILTER_LOG pLog );
Return Value
One of the following notification types:
SF_STATUS_REQ_FINISHED
The filter has handled the HTTP request. The server should disconnect the session.
SF_STATUS_REQ_FINISHED_KEEP_CONN
Same as SF_STATUS_REQ_FINISHED except 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.
SF_STATUS_REQ_ERROR
An error occurred. The server should use the Win32 API SetLastError to indicate the error to the client.
SF_STATUS_REQ_READ_NEXT
The filter is an opaque stream filter; Negotiate the session parameters. Only valid for raw read notification.
If unsuccessful, the notification type SF_STATUS_REQ_ERROR should be returned. In this case, the server should use the Windows function SetLastError and indicate the error to the client.
Parameters
pfc
A CHttpFilterContext object, which contains context information, and can be used by the filter to associate any context information with the HTTP request.
pLog
A pointer to an HTTP_FILTER_LOG structure.
Remarks
This member function is called by the framework to inform the filter when the server is writing information to the server log.
Override this member function to provide your own method for logging information to the server file. The default implementation does nothing.
Example
This example demonstrates how to modify values logged by the IIS for the specific request. For each request to the GIF files, this filter will replace corresponding values of the request log entry with empty values. Depending on the current log format, empty values may be shown as either "-" (hyphen) or as commas (,,).
DWORD CLogNotifyFilter::OnLog(CHttpFilterContext *pCtxt, PHTTP_FILTER_LOG pLog)
{
// TODO: React to this notification accordingly and
// return the appropriate status code
ISAPITRACE1 ("Log notification: %s\n", pLog->pszTarget);
// check if this request is for the file name and includes a gif
// or GIF extension
if ( strstr (pLog->pszTarget, ".gif") || strstr (pLog->pszTarget, ".GIF") )
{
ISAPITRACE ("Request for the GIF (or gif)\n");
// This is one way of copying empty strings to the corresponding
// log entry. Depending on the log format, empty values will be
// represented as "-" or ,,
strcpy ( (char*)pLog->pszClientHostName, "");
// another way is to just set pointers to NULL
*(char *)pLog->pszClientUserName = NULL;
*(char *)pLog->pszServerName = NULL;
*(char *)pLog->pszOperation = NULL;
*(char *)pLog->pszTarget = NULL;
*(char *)pLog->pszParameters = NULL;
}
return SF_STATUS_REQ_NEXT_NOTIFICATION;
}
CHttpFilter Overview | Class Members | Hierarchy Chart
See Also CHttpFilter::HttpFilterProc, HTTP_FILTER_LOG, CHttpFilterContext