The Web Server Program
The web server program is out of 10 points. For seven points you
should
-
Open a TCP socket on a known address.
-
Listen for requests on that socket
-
Fork of a new child
-
Parse the request into a filename
-
Send the filename back to the client
-
Close the connection
For two more points you should
-
Log all requests to a file named access_log.
-
Use the common logfile format.
-
Use lseek and flock to coordinate log file access.
For two more points you should implement the http/1.0 spec
-
Send the current time. See gettimeofday()
-
Send the file length.
-
Send the file type. You'll have to guess this from the file extension.
-
Send a blank line
-
Send the file contents.