MKDIR/USR/SRC/TEMP
CD/USR/SRC/TEMP
gzip ´d stable.tar.gzip
tar xvl stable.tar
CD Perl-5.6.0
rm -f config.sh polycy.sh
SH Configure -de
make -up
Make test
Make Install
What is CGI = https://homepages.dcc.ufmg.br/~mlbc/cursos/internet/cgi/intro.htm
CGI serving web pages (html) = http://devfuria.com.br/miscellaneous/cgi-common-gateway-interface/
What is CGI/formatting forms CGI = http://penta.ufrgs.br/edu/forms/cgi.html
Cgi resources to java and javascript = http://penta.ufrgs.br/pesquisa/joice/cap4.html
CGI really easy/writing scripts CGI to process formulants on the web = https://www.jmarshall.com/easy/cgi/portugueses/
CGI - Common gateway interface = https://web.fe.up.pt/~goii2000/m9/cgi.htm
IBM Environment Variables in CGI Script (Reference) = https://www.ibm.com/docs/en-br/netcoolomnibus/8.1?topic=ssshtq_8.1.0/com.ibm.netcool_omnibus.doc_8.1.0/webtop/wip/reference/web_cust_envariaBlesinchgscripts.html
CGI - TCL/TK language = http://www.c2o.pro.br/automacao/ar01s14.html
CGI Forms = http://penta.ufrgs.br/edu/forms/cgi.html
CGI Tutorial = https://www.w3.org/cgi/
Common Gateway Interface (CGI) = https://en.wikipedia.org/wiki/common_gateway_interface
CGI (Wikipedia) = https://en.wikipedia.org/wiki/cgi
CGI Introduction = http://homepages.dcc.ufmg.br/~mlbc/cursos/internet/cgi/intro.htm
What is CGI (Common Gateway Interface) and what does it do? Common Gateway Interface (CGI) is a technology that allows you to generate dynamic pages with HTTP server script interaction with gateway scripts and programs through parameters. So scripts CGI are the small programs that interpret these parameters and generate a page after processing them.
But the use of the CGI is not very safe, keeping in mind that some security precautions must be taken. Below it will be discussed what security precautions to take based on some CGI programs rules after explaining how the CGI works.
How does it work? Example:
The client (browser) requests a URL from the requested URL for a CGI, so the server performs the CGI CGI works interacting with other system applications, recovers data from these applications and returns the result to the server the server sends the data to the customer, which formats the result and presents the user to enter the image description here.
Why use CGI? With CGI, your server can access information that is not in a readable way to the customer (eg SQL Database), and acts as a gateway between them to produce something the customer can use. Gateways can be used for a variety of purpose, the most common are Isindex manipulation and http form requisition.
CGI Use Examples: Convert HTML Systems Manual Pages and send the HTML result to the customer. Interface with Wais and Archie database, converting the results to HTML and sending the result to the customer. Allow the user to feed their server through an HTML form and a decoder following the CGI. You may be writing these CGI's through gateways that can be written in any liguage that allows you to be executed in the system, such as:
C/C ++ Fortran Perl TCL Unix Shell Visual Basic Apple Script What are the main rules of CGI programs? CGI programs, or scripts, are executable programs that can be executed by yourself (which is not a safe way). Therefore there are some security precautions that need to be implemented when using CGI programs.
The main rules are:
Script CGI has to be in a place determined by the server for scripts CGI or have to have a special suffix, which the server is configured to recognize as a legal CGI script. Most systems stores CGI scripts in a http server root directory called CGI-BIN, which is configured in such a way that only certain reliable users can record it. This avoids obvious safety problems that arise by allowing anonymous remote users to perform anything in the system. Example:/USR/Local/Apache/HTDOCS/CGI-BIN
The script can collect its parameters, default input (via keyboard), environments variables or both.
The script should give as an output, one of the three standard header types, as a normal text string. Being the three types:
Context_Type: The content type refers to any type of MIME data that is accepted by the server. Common types include text/html, text/simple and data/GIF. As the browser/server cannot deduce this type of file from a file name location or suffix, this title will inform the browser what type of data expect and how to use it.
Format: Type/Type
Location: Points to a document somewhere else on the server. Allows you to redirect requests for documents, based on some criterion sent by a form or environment variable.
Status: Can be used to run a script without sending a new page to the customer. It can also be used to send an error message or other information to the customer.
The script must be executable by the user that the server has configured. (There is a special user called "Nobody" which is the default user for most web servers. You must make sure that the "Nobody" user or the user to which your server is configured to work is allowed to run your scripts and read/write in any files the script can use).
More security details in CGI scripts
How to get server information? Each time a user requests the URL corresponding to its CGI program, the server will run it in real time. A wrong concept about CGI is that you can send options of optional commands and arguments for your program, such as:
Command% MyProg -Qa Blorf
CGI uses the command line for other purpose. Gateway uses environmental variables to send its parameters to the program.
How to send documents to the user? CGI programs can return a large number of documents types. You can return an image to the user, an HTML document, or perhaps an audio clip. May also refer to other documents.
The customer needs to know what type of document will receive, so that they can present it properly. Soon the CGI program must inform the server what type of document is being sent.
In order to communicate to the server the type of document that is returning, whether it is a complete document or a reference to another, CGI requires a small header at the exit. This header is an ASCII text, consisting of separate lines or by linerifeeds or by Carriage Returns (or both) followed by a blank line.
Example:
A complete document with the corresponding mime type. Sending an HTML document to the customer.
CONTENT-TYPE: Text/HTML
<title> HTML output from a CGI script </title>CONTENT-TYPE: Text/HTML Location: Gopher: //httprules.Foobar.org/0
<title> Sorry ... moved </title>One form may contain various components such as inputs, check boxes and radio.
How to obtain form data? There are two methods that can be used to access forms, GET and POST. Depending on the method used, you will receive the data differently.
The GET method: If your form uses method = "get", your CGI program will receive the coded data in the Querry_String environment variable. Example:
Login: Password:The Post Method: If your form uses Method = "Post", your CGI program will receive the STDIN standard input data. The server will not send an EOF at the end of the data. Instead you will have to use the Content_length environment variable to determine the amount of data to be read from STDIN.
Example:
Login: Password:How to read an environmental variable will depend on the operating system in which the CGI program will be executed and the programming language in which it was written. A C program running in Unix can use the Char *Getenv (Const Char *name) function; which is named the variable as an argument and returns its value in a string.
Is it an old technology? The CGI was conceived as the culmination of discussions by experts during the early days of the Internet, in 1993 by the National Center (for Supercomputing Applications) namely between Rob McCol, John Franks, Ari Lotonen, George Phillips and Tony Sanders. What can make her considered an old technology.
CGI specification 1.1: RFC3875
Although language typically associated with CGI is perl, CGI was conceived in order to be independent of the language used. Currently technologies like ASP.NET, PHP, Python and Ruby continue to use the specification.
Are there other alternatives to him (which)? FastCGI: It is a binary protocol for interface interaction with a web server.
PSGI: It's an interface between web servers and web perl and frameworks applications that allows you to write applications that can be performed as autonomous servers or using the CGI. Rack: Provides a modular and adaptable interface for the development of web applications in Ruby.
WRB: HTTP server technology similar to Oracle distributed CGI.
Interface: Element that provides a physical or logical connection between two systems or parts of a system that could not be connected directly.
Vision General Insert the description of the image here
Generally, the HTTP server has a directory (folder), which is designated as a collection of documents (files), which can be sent to web browsers linked to this server. For example, if the web server has the Domain Name Example.com, and your document collection is stored in/USR/Local/Apache/HTDOCs in the local file system, then the web server will respond to a order for http://exemplo.com/index.html by sending to the browser the file /usr/local/pache/indocs/indoc.html.
CGI extends this system, allowing the web server owner to designate a directory within the document collection containing executable scripts (or binary files) instead of prescribed pages, this is known as a CGI directory. For example,/USR/Local/Apache/HTDOCS/CGI-BIN could be designated as a CGI directory on the web server. If a web browser requests the URL that points to a file within the CGI directory (for example, http://exemplo.com/cgi-bin/printenv.pl) instead of simply sending the file ( /usr/local/apache/htdocs/cgi-bin/printenv.pl) To the web browser, the HTTP server performs the specified script and passes the script output to the web browser. That is, anything the script sends the default output is passed to the web customer instead of being shown on the screen in a terminal window.
General Structure of Scripts CGI: Data reading and decoding (and/or information fields of an http package);
Data processing (record information on databases, perform calculations, recover data);
Creation of a web page with the results produced.
Examples of CGI's application data processing submitted through forms;
Serve as an interface with the databases, converting the HTML transaction to SQL and formatting to HTML the answers obtained, then sent the results to the customer;
Convert system data to HTML and return the result to the customer;
Creation of personalized documents;
Manage access counters;
Map processing.
Transmission Methods The HTTP protocol uses various data handling and organization methods. The two most commonly used methods to submit form data are the GET and the post. Both methods transfer data from the browser to the server, the biggest difference between them is the way information is passed to the CGI program:
Get
CGI called through the Get method
The browser adds a "?" the URL specified in the Action attribute, and the coded values;
http://exemplo.com/cgi-bin/registra.pl?Login=guest
The server, when receiving a URL with a query-string, calls the CGI program identified in the first part of the URL (before '?') And keeps the part after '?' In the Query_String environment variable (the consultation string contained in the URL after the '?'). Assuming the user typed "Guest" in the login field, when the submit button is clicked, the browser sends to the server.
The GET request identifies the document to be sent (CGI-BIN/record.pl). As long as the server is configured to recognize all files in the CGI-BIN directory as a CGI program, it runs the program instead of sending the document directly to the browser, and puts the String Login = 'Guest' in the Query_String environment variable.
The CGI's programmer cannot control which method the program will be called. Thus scripts are usually written to support both methods.
The data introduced in a form is part of the body of the message sent to the server.
While the GET method passes the information through environmental variables, the post sends the data to the CGI program through Standard Input (default input, STDIO.H), as a string of length specified in the Content_length environment variable;
Makes 2 calls to the server, one to contact the server and one to send the parameters. In other words, if the server receives a form of a form using the post, he knows he has to continue "waiting" the rest of the information.
Advantages/Disadvantages
The advantage of GET is that it allows you to access the CGI program with a query without using a form, basically we are passing parameters for a program. Example: CGI Program
The biggest disadvantage of GET is the lack of security and the fact that there is some care that the browser or server does not trick the information that exceeds the number of characters allowed.
The biggest advantage of the post method is the size of query to be unlimited. For information through the Post method, the CGI program reads Standard Input, so it is not possible to access the CGI without using a form.
History taking into account the speed with which innovations happen, CGI can be considered old, considering computer creation, it can be said that it is in middle age.
In 1993, the team The National Center for Supercomputing Applications (NCSA) wrote a specification to call command line executables at www-voltal email list. However, NCSA does not host the specification.
Other developers have adopted the specification, and has been a standard for web servers ever since. A group chaired by Ken Coar began a job in November 1997 to obtain the most formally defined NCSA definition. This work resulted in RFC3875, which specifies the CGI 1.1 version. Expressly mentioned in the RFC are the following taxpayers:
Rob McCool (author of NCSA HTTPD Web Server) John Franks (Author of Web Server GN) Ari Lotonen (CERN HTTPD Web server developer) Tony Sanders (Plexus Web server author) George Phillips (Web server maintenance at the University of British Columbia).
As an alternative you can consider:
Fastcgi
PSGI (Perl Web Server Gateway Interface)
Rack (Web Server Interface)
WSGI (Web Server Gateway Interface)
Simple example of a CGI script
Put the two numbers: