next page you see but if the url requested by the browser names an executable program instead ( url ending in cgi or py)the http server starts the named program on the server machine to process the request and redirects the incoming browser data to the spawned program' stdin input streamenvironment variablesand commandline arguments that program started by the server is usually cgi script-- program run on the remote server machine somewhere in cyberspaceusually not on your computer the cgi script is responsible for handling the request from this point onit may store your information in databaseperform searchcharge your credit cardand so on response ultimatelythe cgi script prints htmlalong with few header linesto generate new response page in your browser when cgi script is startedthe http server takes care to connect the script' stdout standard output stream to socket that the browser is listening to as resulthtml code printed by the cgi script is sent over the internetback to your browserto produce new page the html printed back by the cgi script works just as if it had been stored and read from an html fileit can define simple response page or brand-new form coded to collect additional information because it is generated by scriptit may include information dynamically determined per request in other wordscgi scripts are something like callback handlers for requests generated by web browsers that require program to be run dynamically they are automatically run on the server machine in response to actions in browser although cgi scripts ultimately receive and send standard structured messages over socketscgi is more like higher-level procedural convention for sending and receiving information between browser and server writing cgi scripts in python if all of this sounds complicatedrelax--pythonas well as the resident http serverautomates most of the tricky bits cgi scripts are written as fairly autonomous programsand they assume that startup tasks have already been accomplished the http web server programnot the cgi scriptimplements the server side of the http protocol itself moreoverpython' library modules automatically dissect information sent up from the browser and give it to the cgi script in an easily digested form the upshot is that cgi scripts may focus on application details like processing input data and producing result page as mentioned earlierin the context of cgi scriptsthe stdin and stdout streams are automatically tied to sockets connected to the browser in additionthe http server passes some browser information to the cgi script in the form of shell environment variablesand possibly command-line arguments to cgi programmersthat means server-side scripting