|
|
|
date: 22 Jan 2006 02:58:18 -0800,
group: microsoft.public.platformsdk.internet.server.isapi-dev
back
Logging Total number of bytes: ISAPI Filter
Hi,
continuing an old thread (that can't be replied to)...
I am using IIS 6. I am trying to log the total number of bytes sent
from the server using the SF_NOTIFY_LOG event. However, if I am also
using the SF_NOTIFY_SEND_RAW_DATA, the dwBytesSent contains incorrect
data (the size of the last chunk). If I remove the usage of
SF_NOTIFY_SEND_RAW_DATA dwBytesSent is correct:
Here is the full code with its output:
#include <windows.h>
#include <httpfilt.h>
#include <stdio.h>
#include <stdlib.h>
FILE *pfLog = NULL;
BOOL WINAPI __stdcall GetFilterVersion(HTTP_FILTER_VERSION * pVer)
{
pVer->dwFlags = SF_NOTIFY_LOG |
SF_NOTIFY_SEND_RAW_DATA |
SF_NOTIFY_PREPROC_HEADERS;
pVer->dwFilterVersion = HTTP_FILTER_REVISION;
strcpy(pVer->lpszFilterDesc, "My Filter");
pfLog = fopen ("c:\\temp\\log.txt", "a");
return TRUE;
}
DWORD WINAPI __stdcall HttpFilterProc (HTTP_FILTER_CONTEXT *pfc,
DWORD
NotificationType,
VOID *pvData)
{
PHTTP_FILTER_LOG pServerLog = (PHTTP_FILTER_LOG) pvData;
PHTTP_FILTER_RAW_DATA pSendRaw = (PHTTP_FILTER_RAW_DATA) pvData;
if (SF_NOTIFY_LOG == NotificationType)
{
fprintf (pfLog,
"URL = '%s', Byte Received = '%d', Bytes Sent =
'%d'\n",
pServerLog->pszTarget,
pServerLog->dwBytesRecvd,
pServerLog->dwBytesSent);
}
if (SF_NOTIFY_SEND_RAW_DATA == NotificationType)
{
fprintf (pfLog,
" ---> Bytes Sent = '%d'\n",
pSendRaw->cbInData);
}
return SF_STATUS_REQ_NEXT_NOTIFICATION;
}
BOOL WINAPI TerminateFilter (DWORD dwFlags)
{
return TRUE;
}
OUTPUT:
---> Bytes Sent = '2048'
---> Bytes Sent = '2048'
---> Bytes Sent = '2048'
---> Bytes Sent = '2048'
---> Bytes Sent = '2048'
---> Bytes Sent = '2048'
---> Bytes Sent = '2048'
---> Bytes Sent = '989'
URL = '/clasys/et_awards.html', Byte Received = '322', Bytes Sent =
'989'
IIS log output:
/clasys/et_awards.html 200 15325 322
thanks
Asaf
date: 22 Jan 2006 02:58:18 -0800
author: Asaf Dalet
Re: Logging Total number of bytes: ISAPI Filter
That looks like a good bug in IIS6 to me. I'll get it looked at.
--
//David
IIS
http://blogs.msdn.com/David.Wang
This posting is provided "AS IS" with no warranties, and confers no rights.
//
"Asaf Dalet" wrote in message
news:1137927498.259899.85220@o13g2000cwo.googlegroups.com...
> Hi,
> continuing an old thread (that can't be replied to)...
>
> I am using IIS 6. I am trying to log the total number of bytes sent
> from the server using the SF_NOTIFY_LOG event. However, if I am also
> using the SF_NOTIFY_SEND_RAW_DATA, the dwBytesSent contains incorrect
> data (the size of the last chunk). If I remove the usage of
> SF_NOTIFY_SEND_RAW_DATA dwBytesSent is correct:
>
> Here is the full code with its output:
>
> #include <windows.h>
> #include <httpfilt.h>
> #include <stdio.h>
> #include <stdlib.h>
>
> FILE *pfLog = NULL;
>
> BOOL WINAPI __stdcall GetFilterVersion(HTTP_FILTER_VERSION * pVer)
> {
>
> pVer->dwFlags = SF_NOTIFY_LOG |
> SF_NOTIFY_SEND_RAW_DATA |
> SF_NOTIFY_PREPROC_HEADERS;
>
> pVer->dwFilterVersion = HTTP_FILTER_REVISION;
> strcpy(pVer->lpszFilterDesc, "My Filter");
>
> pfLog = fopen ("c:\\temp\\log.txt", "a");
>
> return TRUE;
> }
>
> DWORD WINAPI __stdcall HttpFilterProc (HTTP_FILTER_CONTEXT *pfc,
> DWORD
> NotificationType,
> VOID *pvData)
> {
> PHTTP_FILTER_LOG pServerLog = (PHTTP_FILTER_LOG) pvData;
> PHTTP_FILTER_RAW_DATA pSendRaw = (PHTTP_FILTER_RAW_DATA) pvData;
>
> if (SF_NOTIFY_LOG == NotificationType)
> {
> fprintf (pfLog,
> "URL = '%s', Byte Received = '%d', Bytes Sent =
> '%d'\n",
> pServerLog->pszTarget,
> pServerLog->dwBytesRecvd,
> pServerLog->dwBytesSent);
> }
> if (SF_NOTIFY_SEND_RAW_DATA == NotificationType)
> {
> fprintf (pfLog,
> " ---> Bytes Sent = '%d'\n",
> pSendRaw->cbInData);
> }
>
> return SF_STATUS_REQ_NEXT_NOTIFICATION;
> }
>
> BOOL WINAPI TerminateFilter (DWORD dwFlags)
> {
> return TRUE;
> }
>
>
> OUTPUT:
> ---> Bytes Sent = '2048'
> ---> Bytes Sent = '2048'
> ---> Bytes Sent = '2048'
> ---> Bytes Sent = '2048'
> ---> Bytes Sent = '2048'
> ---> Bytes Sent = '2048'
> ---> Bytes Sent = '2048'
> ---> Bytes Sent = '989'
> URL = '/clasys/et_awards.html', Byte Received = '322', Bytes Sent =
> '989'
>
> IIS log output:
> /clasys/et_awards.html 200 15325 322
>
>
> thanks
> Asaf
>
date: Mon, 23 Jan 2006 06:11:34 -0800
author: David Wang [Msft]
|
|