CGI introduces and uses Python to develop CGI application examples

Source: Internet
Author: User
Tags cgi web command line

Introduced

I have not experienced CGI's very fiery years, has never had a chance to learn about the development of CGI web apps, until recently, after listening to a roommate who despised the idea that QQ was still using CGI to develop its own application, the mind gave birth to a thought about CGI, and after some study and research, Also clear up some of the issues, and share with you.

Introduction to CGI

Wikipedia has a more detailed description of the CGI, based on its own understanding summarized below.

First, the role of CGI in processing requests in a Web server is as follows:

As pictured above, CGI plays the role of a protocol that enters output between a Web server and a particular language interpreter, each request from a user, the Web server evokes a command line for a particular language interpreter (for example, Python), and CGI acts as a convention to get the request data from the Web server ( such as url,post data), optionally entered as command-line arguments into the interpreter's command line (standard input), the interpreter constructs a specific HTML as the standard output based on the input, and then the CGI makes additional processing of the output, such as adding a specific header (MimeType, Cookies, etc.) back to the Web server, which is then returned to the user (the Web server may do additional processing).

This is a complete process.

The disadvantages of CGI

CGI as a standard protocol, a variety of mainstream Web servers are supported, such as Apache,iis, then from the above processing process we will find several major drawbacks:

For each request, a process that creates a new interpreter is required, and process creation is usually more expensive (expensive)

Also, for scripting languages, the interpreter needs a certain amount of time to interpret the resulting HTML

A greater chance of code injection, because it is more likely to be injected in a CGI script by manual processing of HTML (depending more on the programmer itself)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.