Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming Project #3CS-4513, D-Term 20071 Programming Project #3 Simple Web Server CS-4513 D-Term 2007 (Slides include materials from Operating System.

Similar presentations


Presentation on theme: "Programming Project #3CS-4513, D-Term 20071 Programming Project #3 Simple Web Server CS-4513 D-Term 2007 (Slides include materials from Operating System."— Presentation transcript:

1 Programming Project #3CS-4513, D-Term 20071 Programming Project #3 Simple Web Server CS-4513 D-Term 2007 (Slides include materials from Operating System Concepts, 7 th ed., by Silbershatz, Galvin, & Gagne, Modern Operating Systems, 2 nd ed., by Tanenbaum, and Distributed Systems: Principles & Paradigms, 2 nd ed. By Tanenbaum and Van Steen)

2 Programming Project #3CS-4513, D-Term 20072 Goal —Simple Multi-threaded Web Server Capable of serving up real web pages Interpreting (a subset of) HTTP protocol Run on CCC machines Also, a web client for debugging purposes

3 Programming Project #3CS-4513, D-Term 20073 Operation % webserver port# [verbose | basic] Create socket, bind to your port# Listen on socket for connection requests In a loop Wait for and accept() connection Spawn a thread to handle connection Repeat …

4 Programming Project #3CS-4513, D-Term 20074 Operation (continued) … Spawned thread must Read client’s request from socket Find file, deliver to client via the socket –(or respond with error indication) Close connection and terminate

5 Programming Project #3CS-4513, D-Term 20075 Two HTTP “rules” Prefix directory name to all files:– –If user asks your server for http://ccc4.wpi.edu:4242/admissions.html –… it supplies /admissions.html (WPI’s web pages are on /www/docs ) If name ends in “/” or resolves to directory Append “ index.html ” to path name Note: it does not hurt to have extra “/” characters

6 Programming Project #3CS-4513, D-Term 20076 Mini-primer on HTTP GET request looks like:– GET /index-t.html HTTP/1.0 Connection: Keep-Alive User-Agent: Mozilla/4.7 [en] (X11; U; SunOS 5.7 sun4u) Host: ccc1.wpi.edu:4242 Accept: image/gif, image/x-xbitmap, image/jpeg, image/png, */* Accept-Encoding: gzip Accept-Language: en Accept-Charset: iso-8859-1,*,utf-8 You need only to –Interpret “ GET ” commands –HTTP/1.0 –Recognize end of header – CR/LF (i.e., \r\n )

7 Programming Project #3CS-4513, D-Term 20077 Responses HTTP/1.0 200 OK\r\n\r\n Followed by the page itself or HTTP/1.0 404 Not Found\r\n\r\n Many HTTP references on the web. –For tutorial, see http://www.jmarshall.com/easy/http/

8 Programming Project #3CS-4513, D-Term 20078 Testing webclient host port# web-page Send a simple HTTP request to {host, port} Prints out the response verbose & basic arguments on webserver Prints out detailed or summary requests and responses to standard out

9 Programming Project #3CS-4513, D-Term 20079 Multi-threading You must demonstrate that your server correctly handles concurrent requests in a multi-threaded way –E.g., adapt webclient to take multiple arguments, spawn separate threads, and Show from debug logs that requests are interleaved

10 Programming Project #3CS-4513, D-Term 200710 Extra-credit Modify your server to support persistent connections I.e., either HTTP v1.1 or Connection: Keep-Alive At end of request, Do not close connection Do not terminate thread Terminate After timeout Connection: close

11 Programming Project #3CS-4513, D-Term 200711 Project Submission Due Friday, April 27, 2007 Via myWPI Zip files together to -Project3.zip Individual project However, you may discuss HTTP protocol with each other Share discussions by e-mail with class

12 Programming Project #3CS-4513, D-Term 200712 Grading Submission via myWPI — 5% Successful make on CCC machines — 5% No warnings Clear, cogent, write-up — 15% Successful operation of webserver on CCC — 25% Fetch WPI web pages with standard browser Successful operation of webclient — 25% Fetch WPI web pages from standard server Successfully demonstrate that server supports more than two concurrent HTTP requests at once — 25%

13 Programming Project #3CS-4513, D-Term 200713 Extra Credit Modify webserver to support multiple, concurrent, persistent web connections at one time — 50% Demonstrate that it does


Download ppt "Programming Project #3CS-4513, D-Term 20071 Programming Project #3 Simple Web Server CS-4513 D-Term 2007 (Slides include materials from Operating System."

Similar presentations


Ads by Google