Comparison of ISAPI and CGI and Its Implementation Gong Jianyong (Huazhong University of Technology Image Identification and Artificial Intelligence) (Communication Address: Western House 203, Huazhong University of Science and Technology, PC: 430074) Abstract: This article introduces two methods for realizing Web interaction, CGI and ISAPI. It is eligible for their principles and reality, and their performance is more than compared. The final brief introduction is the body of ISAPI applications. Keyword: Web interaction CGI Isapi 1. Introduction isaPi and CGI belong to the network-off connector of the WWW server, and the information interact with the client. With the development of WWW burst and its daily benefits, the people's eye light has been sucking the business. Some mains who have to take economic benefits on WWW have the following:
Passing the advertised fees through the advertisements for companies such as enterprises; to enter the net viewer to collect the booking fee; directly selling commercial products and services online. The most important multi-number network station provides information on the information by the user with a guest browser (such as Netscape or Explorer et al.) To the WWW server, then use the mouse point to press the superconnection to browse the main page. In this process, the basin is based on the server to send information to the customer, with the uncharacterization of the service needs, this single-pure single-way communication information is not satisfied. It is not to serve the service to provide a customer, and it is hoped to browse the server to send information to the user, and the user can send information to the server side, and the service server and the client are interactive. Typical applications such as: user logging tables, user-friendly boards, and users through the WWW retrieval server-side data libraries. To achieve a service system that can interact with the user, there are two items that need to be added: interactive homepage and user input information. The interactive home page is an input message, select the home page of the menu button, so that the user input information; the user input information will be handled by the user information. Reality The program can be in a variety of pathways, which can be placed on the server side, or to place the client, such as CGI, ISAPI, the latter, such as Java Applet, etc. This article only discusses the former, will explain the advantages of ISAPI, and will be explained in its implementation. Second, the implementation of the Web Interaction 2.1 Interactive Homepage To realize the interaction environment on the Web, users must enter information on the home page he browsed, this is an interactive home page. In general, the form of user input information is filled in the edit box, click the wireless button, etc., select the drop-down menu, etc., the interactive home page must also have these input element. The next is a simple interactive homepage case: interactive home page HTML source file: isapi1.htm "html"
"Title" TEST "/ Title"
"HEAD"
Isapi Test
"/ Head"
"Body"
"Form action =" / gjy / isapi1 / debug / isapi1.dll? Registeruser "method = post"
Input Your Register Infomation: "Br"
"INPUT TYPE =" text "name =" first "" "BR"
Address: "Input Type =" text "name =" Middle "" "Br"
Email: "Input Type =" text "Name =" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
"Input Type =" reset "" "/ p"
"/ Form"
"/ Body"
"/ Html"
Open this document through the Explorer browser, you can see the following effects (entered in the editor): 2.2 Real estate pathways. From the above-mentioned home page, it is visible that the production of an interactive home page is very simple, but it is necessary to realize the interaction with the user, and must have a reference to the application. This program can be in a variety of patterns such as CGI, Java Applet and ISAPI. In the above web file, there is one: "form action =" / gjy / isapi1 / debug / isapi1.dll? Registeruser "Method = POST"
This refers to the program (isapi1.dll) that should be processed the main page input information, which is the application of ISAPI applications. The order of CGI applications is also the same. In general, the functionality of this program is to transfer user input information to server applications. CGI is a realistic path of real estate, which is more familiar with more familiarity. It can also be the previous most popular, and ISAPI is a micro-unique version of a network application interface standard with a similar CGI function. ISAPI has many excellent characteristics than the CGI of sex. Let me briefly describe the performance difference between CGI and ISAPI and it. Third, CGI principle and its performance 3.1 CGI concept CGI is a common gateway interface, which is a standard interface for WWW server host external service. In general, the function of a CGI interface is in hypertext files and server hosts. Application delivery information. 3.2 CGI programming is in real, one of the programming languages, only can use the CGI interface on the host to use the CGI interface to be used as the CGI program language. Four of the most popular CGI program words: C, Shell, Perl, and Visual Basic, which also have many people in some words, such as TCL, Fortran, and AppleScript, etc. 3.3 The execution of the CGI program is generally a priorcted program. Compiling the CGI program is equally set to set it in a directory. The location of the specific storage is different from the operating system, for example, in the UNIX system is placed in a CGI-bin subdirectory, and under the Windows operating system (note, NT4.0 is not included here for WWW servers in WebStar or Website, The CGI program is placed under CGI-Win. The implementation of the CGI program generally has two modes: 1 is directly called through the URL, such as "http://202.114.2.182/cgi-win/cgi.exe", write directly to the above description directly in the URL column of the browser You can call the program; another way, the main way, is called through the FORM bar in the interactive home page, usually, the user starts the CGI program after filling a input information home page, and the previous interaction The home page is a typical example of this calling CGI.
3.4 The main process of CGI work CGI work is: 1. A user requests to activate a CGI application; 2.CGI application extracts the user input information in the interactive home page; 3. Pass the information input to the server host Applications (such as database query]; 4. Returning server processing results via HTML files to users; 5. CGI process ends. 3.5 CGI performance evaluation CGI's cross-platform performance is excellent, almost in any operating system, such as DOS, Windows, UNIX, OS / 2, Macintosh et al. There are also many options for CGI. CGI applications are generally a separate executable, and the WWW server has different processes, and generally a CGI The program can only handle one user request. In this way, every user request will activate a CGI process. When the number of requests, the number of resources, the resources such as memory, CPU time, etc., resulting in low efficiency, etc. Four, ISAPI principle And its performance 4.1 ISAPI Concept Isapi Internet Server Application Program Interface, is a set of Internet services provided by Microsoft, which enables all functions available by CGI and expands on this basis, such as providing filtration Application interface. 4.2 ISAPI Program Language Because developing ISAPI applications to use Microsoft's set of APIs, it is not as much as CGI to develop ISAPI applications. Mainly Visual C 4.1 or above , Visual Basic 5.0, Borland C 5.0 can also be available. 4.3 ISAPI Homemaster ISAPI The principle and CGI is the same, all of which are used through the interactive homepage, but the post-hand servers background processing. But the two are large in the real estate. Isapi and CGI's largest zone is: not using CGI, the application steps built under Isapi are in the form of dynamic connecting libraries; and CGI should be programs. 4.4 ISAPI program The workfinder for ISAPI should differ from CGI.
The ISAPI application DLL can not only be activated by the user as the CGI program, but can also be pre-activated by the system to monitor the user input; for the user-activated DLL, it will not immediately disappear immediately after processing one user, but continue to reside Waiting for the handle of other users in memory until it has not been entered for a while. 4.5 ISAPI Performance Evaluate a ISAPI's DLL, which can request activation of the re-memory, waiting for another request to wait for the user, and can set multiple users in a DLL, in addition, ISAPI's DLL application and WWW The server is in the same process, and the efficiency is significantly higher than the CGI. It is not possible to have a poor compatibility of ISAPI. It can only be used in Micro-soft Windows 95 and NT operating systems, which are limited to IIS (Internet Information Server) and MS Personal Web Server and Peer Web Server on NT Workstation. V. ISAPI is now able to support the ISAPI-issued platform only with a micro-soft platform group (such as NT IIS, WIN95 MS Personal Web Server). Because this issued ISAPI can only be on these platforms. It has been described before the development of language, which is recommended to the big house, and its Wizard provides a dedicated power of ISAPI. The lower surface is a simple example. The function is to make the user from the browser to the user, the function is simple, but it is a typical ISAPI full process. The source program is as follows (large part is a code for Wizard): 1. Main program: // isapi1.cpp - Implementation File for your internet server
#include "stdafx.h"
#include "isapi1.h"
///
// the one and only cwinapp Object
// NOTE: You May Remove this Object if you alter your project to no
// LONGER USE MFC IN A DLL.
CWINAPPPP;
///
// Command-Parsing Map
Begin_PARSE_MAP (Cisapi1extension, Chttpserver)
/ ************* My Codes Begin Here *********** /
ON_PARSE_COMMAND (RegisterUser,
Cisapi1extension, ITS_PSTR ITS_PSTR ITS_PSTR)
ON_PARSE_COMMAND_PARAMS ("First Middle Last")
/ ************* MY CODES end Here *********** / end_PARSE_MAP (CISAPI1EXTENSION)
///
// the one and only cisapi1extension object
Cisapi1extension theextension;
///
// Cisapi1Extension Implementation
Cisapi1extension :: cisapi1extension ()
{
}
Cisapi1extension :: ~ cisapi1extension ()
{
}
Bool cisapi1extension :: getExtensionVersion
(HSE_VERSION_INFO * PVER)
{
// Call Default IMPLEMENTATION for Initialization
Chttpserver :: getExtensionVersion (PVER);
// load description string
TCHAR SZ [HSE_MAX_EXT_DLL_NAME_LEN 1];
Isapiverify (:: loadstring (afxgetresourcehandle (),
IDS_SERVER, SZ, HSE_MAX_EXT_DLL_NAME_LEN);
_TCSCPY (PVER-> LPSZEXTENSIONDESC, SZ);
Return True;
}
///
// Cisapi1Extension Command Handlers
/ ****** my code begins here ********** /
Void cisapi1extension :: registeruser
(ChttpserverContext * PCTXT, LPCTSTR
PStrfirst, LPCTSTR PSTRMIDDLE, LPCTSTSTR PSTRLAST
{
// Do Processing Here!
* PCTXT << _T ("Your Name IS:");
* PCTXT << _t (pstrfirst);
* PCTXT << _t ("/ n");
* PCTXT << _T ("Your Address IS:");
* PCTXT << _t (pstrmiddle);
* PCTXT << _t ("/ n");
* PCTXT << _T ("Your E_MAIL IS:");
* PCTXT << _t (pstrlast);
}
/ ********* My cots end here ********* /
// Do Not Edit The Following Lines,
Which are needed by classwizard.
#if 0
Begin_MESSAGE_MAP (Cisapi1extension, Chttpserver)
// {{AFX_MSG_MAP (Cisapi1extension)
//}} AFX_MSG_MAP
END_MESSAGE_MAP ()
# ENDIF / / 0
2. Main document
// isapi1.h - Header File for your Internet Server
// isapi1 extension
#include "resource.h"
Class Cisapi1Extension: Public Chttpserver
{
PUBLIC:
Cisapi1extension ();
~ Cisapi1extension ();
// Overrides
// Classwizard generated Virtual function overrides // Note - The ClassWizard Will Add and Remove Member Functions Here.
// Do Not Edit What You See in these Blocks of generated code!
// {{AFX_VIRTUAL (CISAPI1EXTENSION)
PUBLIC:
Virtual Bool getExtensionVersion (HSE_VERSION_INFO * PVER);
//}} AFX_VIRTUAL
// Todo: add handlers for your commands here.
/ *********** My Coded Begin Here (Function Sound) ********* /
Void RegisterUser (ChttpserverContext * PCTXT,
LPCTSTR PSTRFIRST, LPCTSTR
PSTRMIDDLE, LPCTSTSTR PSTRLAST
/ ********* My Codes End Here
Declare_PARSE_MAP ()
// {{AFX_MSG (Cisapi1extension)
//}} AFX_MSG
}
3. PV connection library definition document
/ ************************************ /
/*Api1.def * /
/ ************************************ /
Isapi1.def: Declares The Module Parameters for the DLL.
Library "Isapi1"
Exports
HTTPEXTENSIONPROC
GetExtensionVersion
In the above, a class Cisapi1Extension of a chttpserver is defined. This is the main class of the program, which is implemented with the function of interacting with the user. Really entered from the ON_PARSE_COMMAND segment, which defines a member function registerUser in the DLL in the above program, and its function is to send the user to the message input from the edit box. It is related to the specific segment of the body, and you can see the VC4.2 Help document. The above document is translated into a DLL after the WWW server specified by the WWW server in the servers has the scripts directory of executive power, which is the logical name of the directory and the interactive home page. After the settings, connect to the server through the browser, browse the home page and enter the message to the edit box.