OpSys Fall 2006 - HW5

HW5 - HTTP Server Info

Due Date: 12/4/06 by 11:55PM

Submit to WebCT drop box labeled HW5

Late Policy

- HTTP Server Info

The objectives of this assignment are:

  1. Network Programming (sockets), specifically a TCP client.
  2. Familiarity with the HTTP protocik

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:

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.