M2Web

From VistApedia
Jump to: navigation, search

Overview

M2Web is a software package, created by Jim Self, which provides a CGI connection between a web server such as Apache and a programming system such as MUMPS.

M2Web Issues

What Is CGI

CGI (Common Gateway Interface) is a standard for running (executing) programs that are not built into the World-Wide Web HTTP server from a web server. CGI specifies how to pass arguments to the executing program as part of the HTTP request. It also defines a set of environment variables that exist in the operating system environment, but which are accessible to the executing program. Commonly, the executing program will generate some text formated in HTML which will be passed back along the HTTP connection to the browser running on the client PC. The executing program can also request URL redirection.

CGI specifies the format of the returned data using MIME types, such as returning HTML, but it can return any type that is usable by the browser, including pictures, Microsoft Office or Open Office documents. Every document type usable on a PC can be returned, provided the browser is setup appropriately. It even can act in an arbitrary way as the result of the HTTP request, such as returning a 404 (page not found) error, or a redirect page response. The CGI program can, for example, access information in a database and format the results as HTML. In general, a CGI program can be any program which can accept command line arguments, such as GT.M or Cache. While, Perl is a common choice for writing CGI scripts, anything which can be provided by a Perl program can also be returned by a MUMPS routine, provided the routine is interfaced properly through M2Web. Some HTTP servers require CGI programs to reside in a special directory, often "/cgi-bin" but better servers provide ways to distinguish CGI programs so they can be kept in the same directories as the HTML files to which they are related.

Whenever the server receives a CGI execution request it creates a new process to run the external program. If the process fails to terminate for some reason, or if requests are received faster than the server can respond to them, the server may become swamped with processes.

In order to improve performance, Netscape devised the NSAPI (Netscape Server API) and Microsoft developed the ISAPI (Internet Server API) standard which allow CGI-like tasks to run as part of the main server process, thus avoiding the overhead of creating a new process to handle each CGI invocation.