SE 550: Homework

Deadline: 5.30pm, Tuesday 13 January 2004.


Download the source archive for this course, and make sure you can compile and run the HTTP client and server. For the client:

  javac ajeffrey/teaching/http/client/
  java ajeffrey.teaching.http.client.Main

For the server:

  javac ajeffrey/teaching/http/server/
  java ajeffrey.teaching.http.server.Main

Note: JDK 1.3 contains some bug fixes to the java compiler which are needed by this code. (The handling of final fields in constructors was incorrect in JDK 1.2.) If you get an error like: Variable foo may not have been initialized.

then upgrade your JDK!

Your task is to update the client and server to deal with HTTP 1.1 rather than HTTP 1.0. You should:

Note: under HTTP/1.1 it is mandatory for a client to send a Host: field, for example the following is not legal HTTP/1.1:

  GET HTTP/1.1

Instead, you have to send:

  GET /index.html HTTP/1.1

Also note: you are not required to implement all of HTTP/1.1, just enough to get your client to get files from or from your edited server.

Compile, test and debug your client and server until they work!

Make sure the changes you made are highlighted, and documented, and that your name is on your code, for example:

 * This version of this program has been edited by Jane Doe.
 * All of my edits are highlighted with EDITED by Jane Doe.
 * @version 1.0.2
 * @author Alan Jeffrey and Jane Doe
... stuff which hasn't changed ...
  // EDITED by Jane Doe:
  // I added this debug statement:
  Debug.println ("Jane Doe says: Hello, world.");
... more stuff which hasn't changed ...

Once you have a working edited version of and, create a zip archive containing the two files, and submit it using Courses OnLine.


Harold Chapter 4 on stream I/O, and Chapters 10 and 11 on sockets. Sun's API javadoc documentation on the Socket and ServerSocket classes.