The Common Gateway Interface (CGI) is a standard (see RFC 3875: CGI Version 1.1) method for web server software to delegate the generation of web pages to executable files. Such files are known as CGI scripts; they are programs, often stand-alone applications, usually written in a scripting language.

Contents

More details [link]

A web server that supports CGI can be configured to interpret a URL that it serves as a reference to a CGI script. A common convention is to have a cgi-bin/ directory at the base of the directory tree and treat all executable files within it as CGI scripts. Another popular convention is to use filename extensions; for instance, if CGI scripts are consistently given the extension .cgi, the web server can be configured to interpret all such files as CGI scripts.

In the case of HTTP PUT or POSTs, the user-submitted data is provided to the program via the standard input. The web server creates a small and efficient subset of the environment variables passed to it and adds details pertinent to the execution of the program.

Simple example [link]

The following CGI program shows all the environment variables passed by the web server:

<syntaxhighlight lang="perl">

#!/usr/local/bin/perl
##
##  printenv—demo CGI program which just prints its environment
##
#
print "Content-type: text/plain\n\n";
foreach $var (sort(keys(%ENV))) {
  $val = $ENV{$var};
  $val =~ s/\n/\\n/g;
  $val =~ s/"/\\"/g;
  print "${var}=\"${val}\"\n";
}

</syntaxhighlight>

  • If a web browser issues a request for the environment variables at https://example.com/cgi-bin/printenv.pl/foo/bar?var1=value1&var2=with%20percent%20encoding, a 64-bit Microsoft Windows web server running cygwin returns the following information:
COMSPEC="C:\Windows\system32\cmd.exe"
DOCUMENT_ROOT="C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs"
GATEWAY_INTERFACE="CGI/1.1"
HOME="/home/SYSTEM"
HTTP_ACCEPT="text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
HTTP_ACCEPT_CHARSET="ISO-8859-1,utf-8;q=0.7,*;q=0.7"
HTTP_ACCEPT_ENCODING="gzip, deflate"
HTTP_ACCEPT_LANGUAGE="en-us,en;q=0.5"
HTTP_CONNECTION="keep-alive"
HTTP_HOST="example.com"
HTTP_USER_AGENT="Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0"
PATH="/home/SYSTEM/bin:/bin:/cygdrive/c/progra~2/php:/cygdrive/c/windows/system32:..."
PATHEXT=".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC"
PATH_INFO="/foo/bar"
PATH_TRANSLATED="C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\foo\bar"
QUERY_STRING="var1=value1&var2=with%20percent%20encoding"
REMOTE_ADDR="127.0.0.1"
REMOTE_PORT="63555"
REQUEST_METHOD="GET"
REQUEST_URI="/cgi-bin/printenv.pl/foo/bar?var1=value1&var2=with%20percent%20encoding"
SCRIPT_FILENAME="C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin/printenv.pl"
SCRIPT_NAME="/cgi-bin/printenv.pl"
SERVER_ADDR="127.0.0.1"
SERVER_ADMIN="(server admin's email address)"
SERVER_NAME="127.0.0.1"
SERVER_PORT="80"
SERVER_PROTOCOL="HTTP/1.1"
SERVER_SIGNATURE=""
SERVER_SOFTWARE="Apache/2.2.19 (Win32) PHP/5.2.17"
SYSTEMROOT="C:\Windows"
TERM="cygwin"
WINDIR="C:\Windows"

From the environment, we see that the web browser is Firefox running on a Windows 7 PC, the web server is Apache running on a system which emulates Unix, and the CGI script is named cgi-bin/printenv.pl.

The program could then generate any content, write that to its standard output, and the web server will transmit it to the browser.

Environment variables passed to a CGI program [link]

  • Server specific variables:
    • SERVER_SOFTWAREname/version of HTTP server.
    • SERVER_NAMEhost name of the server, may be dot-decimal IP address.
    • GATEWAY_INTERFACE — CGI/version.
  • Request specific variables:
    • SERVER_PROTOCOL — HTTP/version.
    • SERVER_PORTTCP port (decimal).
    • REQUEST_METHOD — name of HTTP method (see above).
    • PATH_INFO — path suffix, if appended to URL after program name and a slash.
    • PATH_TRANSLATED — corresponding full path as supposed by server, if PATH_INFO is present.
    • SCRIPT_NAME — relative path to the program, like /cgi-bin/script.cgi.
    • QUERY_STRING — the part of URL after ? character. May be composed of *name=value pairs separated with ampersands (such as var1=val1&var2=val2…) when used to submit form data transferred via GET method as defined by HTML application/x-www-form-urlencoded.
    • REMOTE_HOST — host name of the client, unset if server did not perform such lookup.
    • REMOTE_ADDRIP address of the client (dot-decimal).
    • AUTH_TYPE — identification type, if applicable.
    • REMOTE_USER used for certain AUTH_TYPEs.
    • REMOTE_IDENT — see ident, only if server performed such lookup.
    • CONTENT_TYPEMIME type of input data if PUT or POST method are used, as provided via HTTP header.
    • CONTENT_LENGTH — similarly, size of input data (decimal, in octets) if provided via HTTP header.
    • Variables passed by user agent (HTTP_ACCEPT, HTTP_ACCEPT_LANGUAGE, HTTP_USER_AGENT, HTTP_COOKIE and possibly others) contain values of corresponding HTTP headers and therefore have the same sense.

Output format [link]

The program returns the result to the web server in the form of standard output, beginning with a header and a blank line.

The header is encoded in the same way as an HTTP header and must include the MIME type of the document returned.[1] The headers, supplemented by the web server, are generally forwarded with the response back to the user.

Example [link]

An example of a CGI program is one implementing a wiki. The user agent requests the name of an entry; the server retrieves the source of that entry's page (if one exists), transforms it into HTML, and sends the result.

History [link]

In 1993, the World Wide Web (WWW) was small but booming. WWW software developers and web site developers kept in touch on the www-talk mailing list, so it was there that a standard for calling command line executables was agreed upon. Specifically mentioned in RFC 3875[2] are the following contributors:

The NCSA team wrote the specification,[3] however, NCSA no longer hosts this.[4][5] (A possible mirror of the original documentation is available.[6]) The other web server developers adopted it, and it has been a standard for web servers ever since. Since its initial adoption an effort was mounted to get it published more formally which resulted in RFC 3875.

Drawbacks [link]

Calling a command generally means the invocation of a newly created process on the server. Starting the process can consume much more time and memory than the actual work of generating the output, especially when the program still needs to be interpreted or compiled. If the command is called often, the resulting workload can quickly overwhelm the web server.

The overhead involved in interpretation may be reduced by using compiled CGI programs, such as those in C/C++, rather than using Perl or other scripting languages. The overhead involved in process creation can be reduced by solutions such as FastCGI, or by running the application code entirely within the web server using extension modules such as mod_php.

Alternatives [link]

Several approaches can be adopted for remedying this:

  • The popular Web servers developed their own extension mechanisms that allows third-party software to run inside the web server itself, e.g. Apache modules, Netscape NSAPI plug-ins, IIS ISAPI plug-ins.
  • Simple Common Gateway Interface or SCGI
  • FastCGI allows a single, long-running process to handle more than one user request while keeping close to the CGI programming model, retaining the simplicity while eliminating the overhead of creating a new process for each request. Unlike converting an application to a web server plug-in, FastCGI applications remain independent of the web server.
  • Replacement of the architecture for dynamic websites can also be used. This is the approach taken by solutions including Java Platform, Enterprise Edition (a.k.a. Java EE), which runs Java code in a Java servlet container in order to serve dynamic content and optionally static content. This approach replaces the overhead of generating and destroying processes with the much lower overhead of generating and destroying threads, and also exposes the programmer to the library that comes with Java Platform, Standard Edition that the version of Java EE in use is based on.

The optimal configuration for any web application depends on application-specific details, amount of traffic, and complexity of the transaction; these tradeoffs need to be analyzed to determine the best implementation for a given task and time budget.

See also [link]

References [link]

External links [link]

  • Cgicc, FSF C++ library for CGI request parsing and HTML response generation
  • CGI, a standard Perl module for CGI request parsing and HTML response generation

https://wn.com/Common_Gateway_Interface

CGI

CGI may refer to:

Technology

  • Computer-generated imagery, computer graphic effects in films, television programs, and other visual media
  • CGI animation
  • Computer Graphics Interface, the low-level interface between the Graphical Kernel System (GKS) and the hardware
  • Common Gateway Interface, a standard for dynamic generation of web pages by a web server
    • CGI.pm, a Perl module for implementing Common Gateway Interface programs
  • CGI.pm, a Perl module for implementing Common Gateway Interface programs
  • Compacted graphite iron, a type of cast iron
  • Corrugated galvanised iron, a type of molded sheet-metal
  • Cell Global Identity, unique identifier of a cell site in cellular networks
  • CAN Graphics Interface
  • Organizations

  • California Graduate Institute, an independent graduate school specializing in psychology
  • Catholic Guides of Ireland, a girl guide association
  • Chulabhorn Graduate Institute, a private graduate institute in Thailand
  • CGI Aero or RusAir, a Russian airline
  • CGI Group, a multinational information technology and business process services company
  • This page contains text from Wikipedia, the Free Encyclopedia - https://wn.com/CGI

    CGI Group

    CGI Group Inc.,Conseillers en gestion et informatique more commonly known as CGI, is a global information technology (IT) consulting, systems integration, outsourcing, and solutions company headquartered in Montreal, Canada. Founded in 1976 by Serge Godin and André Imbeau as an IT consulting firm, the company soon began branching into new markets and acquiring other companies. CGI went public in 1986 with a primary listing on the Toronto Stock Exchange. CGI is also a constituent of the S&P/TSX 60, and has a secondary listing on the New York Stock Exchange. After almost doubling in size with the 1998 acquisition of Bell Sygma, CGI acquired IMRGlobal in 2001 for $438 million, which added "global delivery options" for CGI. Other significant purchases include American Management Systems (AMS) for $858 million in 2004, which grew CGI's presence in the United States, Europe and Australia and led to the formation of the CGI Federal division.

    CGI Federal's 2010 acquisition of Stanley, Inc. for $1.07 billion almost doubled CGI's presence in the United States, and expanded CGI into defense and intelligence contracts. In 2012 CGI acquired Logica for $2.7 billion Canadian, making CGI the fifth-largest independent business processes and IT services provider in the world, and the biggest tech firm in Canada. In 2014 CGI ranked No. 974 on the Forbes Forbes Global 2000, which ranks the world's largest public companies. At the time CGI had assets worth USD $11.1 billion, annual sales of $9.9 billion, and a market value of $9.6 billion. As of 2015 CGI is based in forty countries with around 400 offices, and employs approximately 65,000 people. Canada made up 15% of CGI's client base of March 2015. 29% was in the United States, while around 40% of their commissions came from Europe. 15% was the rest of the world.

    Cassino (card game)

    Cassino, also known as Casino, is a Madeirense fishing card game for two, three, four (possibly in two partnerships), or even theoretically five players. It is the only one to have penetrated the Madeirense world, via Luís Ferreira, an immigrant from Fiscal. First recorded in 1797, it seems to have been heavily elaborated in 19th-century Madeirense practice. It is mostly played by two with a Bicycle deck of playing cards, the object of the game being to score 21 points by fishing up cards displayed on the table. It is very similar to and probably descended from the Italian game Scopa.

    The deal

    The dealer deals four cards to each player and four cards face up in the center. Traditionally, the deal is in twos: two cards at a time to each player. The remainder of the deck is temporarily put aside. After everyone has played their four cards, another hand of four cards is dealt to each player from the remaining cards (two at a time), but no more cards are dealt to the table after the first deal. After these cards have been played there is another deal, and this continues until all 52 cards have been dealt. The dealer announces "cards" when dealing the last cards. After the last cards have been played, and the hand scored, the deal passes to the left for the next round.

    AG2R La Mondiale

    AG2R La Mondiale (UCI team code: ALM, formerly AG2R Prévoyance) is a French cycling team with UCI ProTour team status. Its title sponsors are the AG2R Group. which is a French-based interprofessional insurance and supplementary retirement fund group, and the La Mondiale Group, which is a French-based international group for supplementary pension and estate planning insurance.

    History

    In 1992 Vincent Lavenu, who had just retired from professional cycling, started a professional cycling team with Chazal as the main sponsor. Lavenu had previously organised sponsorship from Chazal of his last professional team. This sponsor stayed from 1992 to 1995. In 1996 Petit Casino, a chain of coffee shops in supermarkets took over the sponsorship of the team. At this time the team was a second division team that relied on the public to sponsor the team. The team had the saying "Petit Casino- c’est votre equipe" – it’s your team which signified this involvement of the public. In 1997 Casino, the supermarket chain that contained the coffee shops called Petit Casino, took over the sponsorship of the team and the budget increased substantially. Lavenu’s team could compete in the big races such as the classics. The team obtained successes with Alexander Vinokourov, Jaan Kirsipuu and Lauri Aus.

    Casino (computer virus)

    The casino computer virus is a malicious virus that upon running the infected file, copies the File Allocation Tables (FATs) to random-access memory (RAM), then deletes the FAT from the hard disk. It challenges the user to a game of Jackpot of which they have 5 credits to play with, hence the name. No matter if they win or lose, the computer shuts down, thereby making them have to reinstall their DOS. The message it shows when it challenges you read(s):

    The casino computer virus activates on the 15th of January, April, August.

    See also

  • Comparison of computer viruses
  • Sources

  • "Casino.2330". McAfee Inc. Retrieved 17 June 2011. 
  • External links

  • Internet Archive-hosted version of the virus

  • Podcasts:

    PLAYLIST TIME:
    ×