| OpSys Fall 2006 - HW5 |
|   OpSys Home   |   Assignment   |   Requirements   |   Submitting   |   Notes |
- HTTP Server Info
The objectives of this assignment are:
You are to write a program that accepts any number of server names
on the command line. Each name could be either a hostname, or an IP
address. Your program should assume each server is an HTTP server,
send it a request and extract the Server: response header
from the response (and print it out).
We could then use your program to find out what HTTP server code is running on any HTTP server on the web.
Issues:
You can assume all servers are running on TCP port 80
You can assume all servers support HTTP/1.1
You cannot make any assumptions about how the response will arrive at the client. It could arrive in single byte chunks, one per second, or it could arrive as one big chunk containing the entire response.
Your program should print out a message if it is not able to contact any of the servers listed on the command line (calling connect fails).
You do not need worry about what to do with a non-responsive server. (What if a server never sends back a response?) We know how to use ^C.
Sample Session:
> ./hw5 128.213.1.1 www.cs.rpi.edu www.rpi.edu ebay.com google.com 128.213.1.1: Generic www.cs.rpi.edu: Apache www.rpi.edu: Apache/1.3.27 (Unix) (Red-Hat/Linux) mod_ssl/2.8.12 OpenSSL/0.9.6b mod_ldap_userdir/0.9 ebay.com: Microsoft-IIS/6.0 google.com: GWS/2.1 > ./hw5 ftp.cs.rpi.edu Problem connecting to server: Connection refused |
- How to Submit
Log in to WebCT at webct.rpi.edu using your RCS id and password. Once you get to MyWebCT click on "Operating Systems", and from there go to the homework drop boxes. Submit your files (individually, zipped or tarred) to the drop box labeled HW5.
- Notes:
Feel free to use any of Dave's Sample Code as a starting point.
For the details of the HTTP protocol:
We will test this on our own server that sends back the HTTP response in small (unpredictably sized) chunks! You will lose 10 points if it can't work with this server!
You don't need to read the entire response, all you need is the
Server response header. If you want to read the entire
response,
you need to know when the response is complete, which means you will
need to read the Content-length header, and read that
many bytes after the blank line the marks the end of the response
headers.