CGIServingProgramming

CGIServingProgramming - CGI Web Server Architecture Client...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CGI Web Server Architecture Client CGI program stdin stdout h t t p Socket Queue connect newSkt Web Server // Server pseudo code // Create Socket Queue // Create Thread pool while(1) { newSkt = accept() EnQ(newSkt) } // Thread pseudo code while(1) { newSkt = DeQ() if ( not cgi) { // Communicate // using HTTP } else LaunchCGI() } GET vs. POST POST /path/script.cgi HTTP/1.0 From: frog@jmarshall.com User-Agent: HTTPTool/1.0 Content-Type: application/x-www-form-urlencoded Content-Length: 32 home=Cosby&favorite+flavor=flies GET /path/file.html?n=v HTTP/1.1 Host: www.host1.com:80 [blank line here] Most (not all) CGI scripts are contacted through the use of HTML forms. A form is an area of a web page in which the user can enter data, and have that data submitted to another page. When user hits a submit button on the form, the web browser contacts the script specified in the form tag. Forms <form method="post" action="file.cgi"> ... <input type="submit" value="Submit Form"> </form> Method attribute specifies how parameters are passed "post" means theyre passed in the HTTP header and message body (and therefore arent seen on the browser address bar). "get" means theyre passed through the query string of the URL itself, and therefore seen in the address bar in the web browser (given to CGI program in the QUERY_STRING header). Action attribute specifies which program you want the web browser to contact....
View Full Document

Page1 / 20

CGIServingProgramming - CGI Web Server Architecture Client...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online