简体   繁体   中英

How to link request in ISAPI extension to response in ISAPI filter?

I'm building sort of a http sniffer for IIS6, for that I'm using both ISAPI filter and ISAPI extension. Extension - to read the request. Filter - to read the response.

The reason i'm using extension is that I don't want to force the user to change to IIS5 Compatibility Mode and therefore can't subscribe to SF_NOTIFY_READ_RAW_DATA.

The thing is, when I read the response, I want to link it to the request, so I need to give a unique identifier to the request, and use it when reading the response.

I have read that there used to be an option to call ServerSupportFunction with SF_REQ_GET_CONNID, but that's not supported in IIS6.

Also I have read that a possible solution is to append customer header and then remove it - that would probably work, but seems less elegant than I hoped to implement.

Is there any way to get the connection ID (connID in EXTENSION_CONTROL_BLOCK) in the filter?

appreciate your response, Sagiv

I had the same problem a few months ago.

I did the following to solve the problem:

  1. On HttpFilterProc (ISAPI Filter) I looked for notification SF_NOTIFY_PREPROC_HEADERS.
  2. I then injected my own header with a GUID to the request.
  3. On HttpExtensionProc (ISAPI Extension) I read my header and extract the GUID.
  4. I then read the request content and connected it with the GUID.
  5. On OnSendRawData (ISAPI Filter) I read the (chunked) response content and again connect it with the GUID.

This way I have both the request content (from the Extension) and the response content (from the filter) linked!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM