How does an ISAPI filter distinguish between loading IIS or ISA?

I have an application implemented as an ISAPI filter whose behavior needs to be changed depending on whether it is loading ISA or IIS. During GetFilterVersion, it must register for SF_NOTIFY_SEND_RAW_DATA if it is loaded by ISA or SF_NOTIFY_SEND_RESPONSE if it is loaded by IIS.

There seems to be no information about the server passed to GetFilterVersion. Are there any tricks that can identify and distinguish between IIS and ISA?

[edit]

An application needs to know which server loads it during initialization during a GetFilterVersion call. There is no current request, so trying to get SERVER_VARIABLE from header variables will not work; There are no header variables at this point.

To develop, my application sets response headers such as cookies and cache control headers. When starting in the context of the ISA server, to perform this operation, you must use the SF_NOTIFY_SEND_RAW_DATA event, changing the initial data sent by the ISA proxy server. However, in IIS, using this notification is associated with a serious performance hit, so the application must use SF_NOTIFY_SEND_RESPONSE. SF_NOTIFY_SEND_RESPONSE will not work with ISA, because this event is not triggered for proxied responses, only for responses that originate from ISA itself, such as error pages. Finally, event logging occurs once during GetFilterVersion () and cannot be changed after loading the filter.

, SF_NOTIFY_SEND_RESPONSE SF_NOTIFY_SEND_RAW_DATA, , IIS ISA.

+3
3

IIS ISA . "w3proxy.exe" ISA, "w3wp.exe" IIS. , .

HANDLE winapi GetCurrentProcess()

this:

DWORD WINAPI GetModuleFileNameEx(
  __in      HANDLE hProcess,
  __in_opt  HMODULE hModule,
  __out     LPTSTR lpFilename,
  __in      DWORD nSize
);

+2

isapi, . isapi GetServerVariable "SERVER_SOFTWARE"

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

"GetServerVariable" , , .

-don

0

you could get SERVER_SOFTWARE(or another variable indicating ISA versus IIS) from the environment via getenv().

0
source

Source: https://habr.com/ru/post/1732368/


All Articles