View Complete Thread
  • Re: A little problem: IIS 6.0 custom logging + HTTP pipelining

    Apr 14, 2009 02:20 PM|_OK|LINK

    Anil,

    The solution would be to free the memory in the SF_NOTIFY_PREPROC_HEADER for the next request or SF_NOTIFY_END_OF_NET_SESSION when the client disconnects - whichever happens first. 

    Right…

    ---------------------------------------------------------------------------------------

    ISAPI Filter Event Notifications

    http://msdn.microsoft.com/en-us/library/ms524855.aspx

     

    Important Note:

    Due to the complex and dynamic event model IIS uses, it is important that developers not rely on the exact sequence described above. An ISAPI filter must handle the occurrence of events in nonstandard order without failing and, more importantly, without causing IIS to fail.

    ---------------------------------------------------------------------------------------

     

    1-st SF_NOTIFY_PREPROC_HEADERS – get memory.

    Subsequent SF_NOTIFY_LOG – set pointer to the memory for log operation.

    N-th SF_NOTIFY_PREPROC_HEADERS – free memory.

     

    The only problem here – how do I know that Log was actually written before I free memory?

    Technically, either SF_NOTIFY_END_OF_REQUEST should be called after SF_NOTIFY_LOG _AND_ Log was actually record written (because, IMO, log writing is part or request)

    Or better – it should be SF_NOTIFY_END_OF_LOG event. AKA undocumented function. (C) MS

     

    I guess, I can still make it work with current schema by implementing:

    1. “remember” time (A) of 1st SF_NOTIFY_PREPROC_HEADERS

    2. Check somehow what is the current record time in IIS log (B).

    3. If B > A – my log record has to be written already so it’s safe to free memory

     

    Is there any better approach or am I missing something?

      

    And one more question:

    Does anybody when above “Important Note” come into play?