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/Main.java java ajeffrey.teaching.http.client.Main
For the server:
javac ajeffrey/teaching/http/server/Main.java 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:
Blah.java:999: 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:
Connectionclass so that it will deal with HTTP/1.1 requests as well as HTTP/1.0 requests, and so that it will issue HTTP/1.1 responses rather than HTTP/1.0 responses.
HTTPIOso that it sends a valid HTTP/1.1 get request.
Note: under HTTP/1.1 it is mandatory for a client to send a
field, for example the following is not legal HTTP/1.1:
GET http://fpl.cs.depaul.edu/index.html HTTP/1.1
Instead, you have to send:
GET /index.html HTTP/1.1 Host: fpl.cs.depaul.edu
Also note: you are not required to implement all of HTTP/1.1, just enough
to get your client to get files from
fpl.cs.depaul.edu 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
Connection.java, create a zip archive
containing the two files, and submit it using
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.