CST(69)-CGI: The Server Side Of The Web

An end-to-end client/server protocol that includes both HTTP and CGI. The best way to explain the dynamics of the protocol is to walk you tr...

An end-to-end client/server protocol that includes both HTTP and CGI. The best way to explain the dynamics of the protocol is to walk you trough a POST method invocation. Here’s the step-by-step explanation of this interaction:
  •  User clicks on the form’s “submit” button: This causes the web browser to collect the data within the form, and then assemble it into one long string of name/value pairs each separated by an ampersand (&). The browser translates spaces within the data into plus (+) symbols.
  •  The web Browser invokes a POST HTTP method: This is an ordinary HTTP request that specifies a POST method, the URL of the target program in the “cgi-bin” directory, and the typical HTTP headers.
  •  The HTTP server receives the method invocation via a socket connection: The server parses the message and discovers that it’s a POST for the “cgi-bin” program. So its starts a CGI interaction.
  •  The HTTP server sets up the environment variables: The CGI protocol uses environment variables as a shared bulletin board for communicating information between the HTTP server and the CGI program. The server environment variables are server_name, request_method, path_info, script name etc.,
  •  The HTTP server starts a CGI program: The HTTP server executes as instance of the CGI program specified in the URL.
  •  The CGI program reads the environment variables: In this case, the program discovers by reading the environment variables that it is responding to a POST.
  •  The CGI program receives the message body via the standard input pipe: The message body contains the famous string of ‘name=value’ items separated by ampersands (&). The content_ length environment variable tells the program how much data is in the string.
  •  The CGI program does some work: Typically, a CGI program interacts with some back-end resources – like a DBMS or transaction program – to service the form’s request. This information goes into the HTTP response entity, which really is the body of the message. Your program can also choose on provide all the information that goes into the HTTP response headers.
  •  The CGI program returns the results via the standard output pipe (stdout). The program pipes back the results to the HTTP server via its standard output. The HTTP server receives the results on its standard input. This concludes the CGI interaction.
  •  The HTTP server returns the results to the Web browser. The HTTP server can either append some response headers to the information it receives from the CGI program.
A CGI program is executed in real time; it gets the information and then builds a dynamic Web page to satisfy a client’s request. CGI makes the Web more dynamic.

Best Online Tutorials | Source codes | Programming Languages: CST(69)-CGI: The Server Side Of The Web
CST(69)-CGI: The Server Side Of The Web
Best Online Tutorials | Source codes | Programming Languages
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content