6 Gateway Mode

Contents of this section

On some systems, particularly those with limited memory or processor power, a FlagShip-compiled program may take more than a few seconds to start before executing any programmer-supplied code. If your WWW server gets more than a little traffic, or if clients are seeing inordinate delays in receiving output from your WebKit-enabled server, you should be using Gateway mode.

In Gateway mode, a CGI-enabled FlagShip program acts like a network daemon. Instead of being invoked directly by the HTTP server for each client request, it is started as a background process (just like a Usenet news server or database server) accepting connections from a shell script that is in turn invoked by the HTTP server.

In Gateway mode, it is the WebKit Gateway program that is invoked directly from HTML; it passes the CGI input over a network socket to your CGI-enabled FlagShip program, and returns the output back to CGI, but does no intelligent processing itself.

webkit-gateway is installed in the cgi-bin directory with the sticky bit set to suggest to the operating system that it remain in memory for enhanced performance. Because the FlagShip runtime engine has some specific requirements for its startup environment, you cannot actually run the FlagShip application directly in the cgi-bin directory without severely compromising system security.

Notably, your developer-supplied FlagShip application code will be exactly the same whether you run it in Direct mode or Gateway mode.

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter