OS Options: Must run on our shell servers
- Part 1 [20 points total]: Modify one of the Echo Client applications given in class.
The new Echo Client you create should read lines from standard input and
send each line to the Echo Server in a loop until it receives and end-of-file indication.
The application must take the IP address (or hostname) and port to connect to on the command line as a URL of the form
echo://hostname[:portnum].
- Part 2 [20 points total]: Modify one of the Echo Server applications given in class.
The new Echo Server should have two additions:
- A [10 points]: It should process each connection until the client disconnects.
In other words, the server should loop around the recv/send part until the
recv returns a value of 0 bytes received. In other respects, this new Echo Server
should conform to the RFC document for Echo given in class.
- B [10 points]: It should handle multiple connections concurrently. For C/C++, this means
adding usage of fork() and reaping all child processes or using POSIX threads. For Java, the use of the
Thread class will be necessary.
- Part 3 [60 points total]: Write a basic web server that can
handle the GET request method. You may not rely on any intrinsic Java objects that do
any of this for you.
This part requires multiple pieces to be done so I
suggest working on each part separately and verify that each part works by
itself. These parts are:
- A [10 points]: Construct a routine or object that can read an HTTP/1.0
request from a socket and parse it into request method, request-URI, HTTP version,
headers, etc.
- B [10 points]: Construct a routine or object to construct a HTTP response
given a status code, phrase, headers, and a body and send that response back on
a socket.
- C [20 points]: Take the routines or objects constructed above and
construct an application that listens on a port for connections. Connections
that are accepted should then be treated like HTTP request and use the routines
or objects above. I.e. retrieve an HTTP request on a socket, parse it,
open the file indicated by the URI and send the contents back as an HTTP request. Files that can not be
opened should generate a 404 status code. Requests that are not "GET" should generate
a 501 status code.
- D [5 points]: Modify C so that it sends back the "Date" header with
the time of day in it.
- E [5 points]: Modify C so that it sends back the "Content-Length" header
with the correct object size.
- F [5 points]: Modify C so that it sends back the "Last-Modified" header
with the correct object modification date.
- G [5 points]: Modify C so that it can understand the "HEAD" request
method and returns the "Content-Length", "Last-Modified", and "Date" headers for
the object.
Notes:
Your submissions must at least compile before any credit will be given.
Submissions that do not compile will not be graded. Submissions submitted
after the due date will not be graded. All work must be your own original work.
To get partial credit for parts of the assignment, you must demonstrate that
those pieces work by themselves.
If you share code with others, you will be given a 0 for the assignment. This
assignment set is worth 25% of your total grade.
HTTP 1.0 Specification at http://www.w3.org/pub/WWW/Protocols/HTTP/1.0/spec.html
Extra Credit
Value: up to +12% onto total grade
For extra credit, construct a client application that understands HTTP and FTP
URLs and uses the appropriate protocol for downloading an object to a local
file system. This should work similar to the wget application
and should support passive FTP and normal FTP [12%].
Todd L. Montgomery (revised 09.09.2002)