|
ISAPI OverviewThe Internet Server API (ISAPI) is a Windows-specific alternative to the Common Gateway Interface (CGI). Originally proposed by Process Software, ISAPI has been adopted by Microsoft as the standard plugin interface for its IIS Web server.While CGI scripts have the advantage of being interpretive and easy to maintain remotely, it has a number of performance drawbacks, in that CGI plugins generally need to be loaded into memory each time they are used, and require slow standard input/ouput (stdio) and environment variable mechanisms to pass information between HTML forms and the Web server. ISAPI has several advantages:
The only real down side is that ISAPI plugins are not portable. But since this only impacts servers, and ISAPI plugins are so easy to create, this is not a substantial road block to their use. While not Common Object Module (COM) compliant, Microsoft has grouped ISAPI under its Active X umbrella. ISAPI is supported by Microsoft's IIS server, NetManage's Personal Web Server, O'Reilly's WebSite, and a number of other popular NT Web servers. Shareware ISAPI shims are also becoming available for other NT-based Web servers, such as Netscape and Apache servers.
How it WorksISAPI plugins are DLLs with two required exported methods/APIs:
HttpExtensionProc When the Web server load an ISAPI plugin, it first calls the module's GetExtensionVersion to determine what ISAPI version it expects. If supported, it then calls HttpExtensionProc whenever an ISAPI form needs to be processed. HttpExtensionProc is used by the Web server to pass various info to the plugin, such as information about the server, pointers to read/write methods and any request-specific data. The ISAPI plugin then processes the server request in much the same way a CGI handler would, with the exception that GetServerVariable is used to retrieve CGI variables, ReadClient and WriteClient are used instead of stdio, and ServerSupportFunction can be used to access certain Web server support functions.
Creating ISAPI PluginsThe best way to start creating ISAPI plugins is to get Microsoft's Active X SDK.Check out the samples -- they are pretty straight-forward. Converting your existing CGI programs to ISAPI is fairly easy to do; it mostly involves changing stdio calls to ISAPI Read/WriteClient calls.
|