From CS 455/555 Fall 2009

CS455-F09: Program 3: HTTP Request Capture and HTTP Client

Assigned: Tuesday, October 27, 2009
Due: Tuesday, November 10, 2009 before class

Description Rules Testing Submission


The goal of this assignment is to help you become familiar HTTP requests and HTTP responses. We'll be implementing an HTTP request capture program so that you can look at requests generated by your favorite web browser and a simple HTTP client so that you can practice building valid HTTP requests and processing HTTP responses from real web servers.

HTTP Request Capture

As with the Programs 1 and 2, if any of the arguments are incorrect, exit after printing an error message of the form ERR - arg x, where x is the argument number.


HTTP Client

Note: Print the actual string sent to the server. Do not send a request and then re-type the request for output.



A large part of your program's grade will be determined by how well it handles a set of inputs. You should test your program rigorously before submitting. Because your programs will be run and tested using a script, you must format your output exactly as I have described or you will lose points.

Example 1

java HTTPReqCap
Usage: java HTTPReqCap port

Example 2

java HTTPReqCap 10003
GET /my/url HTTP/1.1
User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.7) Gecko/20070606
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive

Example 3

java HTTPClient 
Usage: java HTTPClient URL

Typo fixed (no java) -MCW 11/03/09

Example 4

java HTTPClient
HEAD /~mweigle/files/foo.txt HTTP/1.0
User-agent: ODU-CS455/555

Sat, 16 Sep 2006 17:38:59 GMT

HTTP/1.1 200 OK
Date: Thu, 19 Feb 2009 20:54:19 GMT
Server: Apache/2.2.0
Last-Modified: Sat, 16 Sep 2006 17:38:59 GMT
ETag: "7ab46d-5f-9da4d2c0"
Accept-Ranges: bytes
Content-Length: 95
Connection: close
Content-Type: text/plain


You must name your source files and (note the capitalization). Make sure that you submit all files necessary to compile your program. But, do not submit compiled files (.class files).

Directions for submitting your assignment through Blackboard

Retrieved from
Page last modified on November 03, 2009, at 03:00 PM