Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
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]

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us