In this lab you will implement a fairly complete httpd. You will need to have the netscape browser connect to your httpd and will be able to transfer files across the network.
This tutorial should help you in getting your httpd working. You might also want to look at some cgi documentation.
You will probably want to fork off a child or thread to handle each http session. This will allow several clients to access files at the same time.
You can test using the following files:
You should be able to access them by putting a url that looks something like
http://flute.cs.byu.edu:1236/students/cs460ta/public_html/test1.html
In this example I am running the server on flute at port 1236 and am trying to access the file in the directory /students/cs460ta/public_html/test1.html. You can put the files in any location, but you must be able to access them from a normal browser (netscape or ie). If the file does not exist, or if you get any other error, you should construct an appropriate error page and send it back. If the file is a directory, you should first look to see if there is an index.html file in the directory. If so, you send it back, if not, you should produce a listing of the files in the directory, format it with a html header and trailer and then send that page back to the browser.
"HTTP/1.0 200 OK\r\n" "MIME-Version:1.0\r\n"strings. The CGI script will send the content type and everything else. You can access it with a url that looks something like the following. If you put it in your cgi-bin directory, then you can test it with the normal web server for "students" to see what the output should be.
http://flute.cs.byu.edu:1236/students/cs460ta/public_html/cgi-bin/test5.cgi
http://flute.cs.byu.edu:1236/students/cs460ta/public_html/cgi-bin/test6.cgi?teststring
The following passoff levels will apply to this lab:
|
Passoff Level |
Behavior |
Points |
|
Minimal Passoff |
You can send the basic html, txt, gif, jpg files |
4 Points |
|
Basic CGI |
You can run test5.cgi |
3 Points |
|
Perfect behavior |
You can also pass environment variables to test6.cgi and list the contents of a directory if specified |
3 Points |