Programming Assignment 1:  Web Proxy Cache

 

Frequently Asked Questions

 

Are we allowed to use jdk1.4 RC for this assignment?

No! For the purpose of uniformity, and since version1.4 is a release candidate, we prefer the program to be written in jdk1.2 or 1.3.

 

What is the unit of cache size in –c option of the command line?

The cache size should be in kiloBytes.

 

How should HTTP requests other than GET, i.e. HEAD and POST, be handled?

The proxy should return a 501 Not Implemented error message!  The browser should also display other error messages properly.

 

Having trouble loading images.

One possible reason could be that you are reading data from the streams as strings.  Preferably you should read and write them to the socket streams as bytes.

 

Should the cache handle the Expires header?

Yes! We expect you to handle this header.  The Expires header helps you calculate the expiration time of the web page.  Therefore, a cached entry will have to be fetched again if it is requested after the expiration time.

 

Other suggestions!

For simplicity you are allowed to use HTTP/1.0 between the proxy and the web server.  HTTP/1.1 uses persistent connections, which could give you occasional problems using sockets.  For this modification, the proxy will have to take the HTTP/1.1 request and replace HTTP/1.1 with HTTP/1.0 before sending it to the web server.  HTTP/1.0 requests will just have to be echoed to the web server.

Note: This is just a suggestion and not mandatory to implement.

 

Does the If-modified-since header have to be supported?

This is not a must!  You will get extra points for a correct and efficient implementation of this feature, but no points will be deducted for not implementing it.

 

How should pages with no Expires header be handled?

There are a couple of ways of handling this: 1) you fetch the page each time it is accessed.  Makes no sense to cache this page.  OR 2) you have your own expiration time, and you cache the page for that duration.  Either implementation is fine with us.

 

Should HTTP/1.1 be supported?

The browser could use HTTP/1.1 and you will have to provide support for this feature.  However, you do not have to implement the complex features of HTTP/1.1!  So, if the browser sends a 1.1 request, you just need to respond to the request, i.e. fetch the page corresponding to the GET request.

 

What should be printed in the command line during proxy execution?

The statement corresponding to an event should be displayed in the command line:

·        "Started a new Thread for the <request>"

·        "Exiting Thread"

·        "Added <the url> to Cache, should be evicted after <duration>"

·        "Evicted <the url> from Cache because of the Expires header"

·        "Evicted from Cache because it is full"

·        "Reading Response from Cache"

·        "Response not in Cache. Getting it from the Server"