project1 - DOC by liaoxiuli


									CS455 Introduction to Computer Networks, Fall 2009, WSU Vancouver

          Project : Design Multi-threaded Web Server

In this programming project, you will develop, in C under Linux, a multithreaded Web
server that is capable of serving multiple requests in parallel. You are going to implement
version 1.0 of HTTP – Nonpersistent HTTP with parallel TCP connections (Recall
HW1), as defined in RFC 1945.

Recall that HTTP/1.0 creates a separate TCP connection for each request/response pair.
There will also be a main thread, in which the server listens for clients that want to
establish connections. To simplify the programming task, we will develop the code in
two stages. In the first stage, you will write a multithreaded server that simply displays
the contents of the HTTP request message that it receives. After this program is running
properly, you will add the code required to generate an appropriate response.

As you develop the code, you can test your server with a Web browser. But remember
that you are not serving through the standard port 80 (since it might be forbidden by OS),
so you need to specify the port number with the URL. For example, you server is
listening to port 10000, and you want to retrieve the file <index.html>, then you should
type following in the browser:

When you server encounters an error, it should send a response message with an
appropriate HTML source so that the error information is displayed in the browser

1.1 Functions
   Specifically, you need implement the following methods and options:

   (1) Support GET method and response correctly; [20 points] also support conditional
       GET (if the object did not changed, do not re-send); [10 points]
   (2) Support POST method and echo the submitted content back to web browser; [20
   (3) Accept GET method without file name specified. By default, the server should
       return an index.html file in that requested directory if available. [10 points]
   (4) Several web browsers can connect to web server at same time. In other words, it
       should be multithreaded. [20 points]

1.2 Conventions and Skills
   (1) [10 points] For easy of grading, you need follow below file name/directory
       conventions. HTTP server program is named as <httpsrv.c> and the runnable
       program as <httpsrv>. Organize all your source code and test files as the
CS455 Introduction to Computer Networks, Fall 2009, WSU Vancouver

       following structures, and submit them in a zip file with your first name as the file
        [Your First Name]
                   |-- webpage --| *.html      // contains all test HTML files
                   |-- httpsrv.c               // the main program source code file
                   |-- *.c, *.h                // other source files you provided
                   |-- readme.txt              // explain what’s in the packet and how to
                   |                           // test your program
                   |-- makefile
       * Notice: [webpage] directory is your default www-root directory
   (2) [10 points] will subject to your code’s organization & modularity, readability &
   consistency, and robustness (bug-free). In other words, these points are rewarded
   according to your programming skills.

1.3 Summary

   To summarize, grading will strictly follow the policy below:
   (1) Totally 100 points, late submission will cause 20% penalty each day;
   (2) Demonstration to TA is necessary. If not, 0 points will be warded.
   (3) If the program can not be compiled or run in Linux, 0 points will be awarded;
   (4) If the source code is stolen from Internet, 0 points will be awarded;
   (5) All the other points are earned according to above descriptions on functions,
       conventions and programming skills.

To top