next up previous
Next: Cache Management Up: Implementation Previous: Implementation

Connection handling

For each connection a client object is created, which, among other things, keeps track of the connection's state. After the client object has been created it is in the 'Reading request' state. The state updating function will make sure that the proxy will not enter the next state (Processing request) until the request has been read completely.

Once in the 'Processing request' state the proxy starts extracting information from the various headers. When that is done, the proxy decides whether to use the cache or not. If so, the proxy generates a hash key and checks the cache. The client object enters the 'Cache open' state if we have a cache hit and we can use a cached copy, but 'Connect to server' otherwise.

If the cache is not used (that case will be described in the next section), the proxy will open a socket to the remote host in the 'Connect to server' state and quickly enter the 'Forward request to server' state. There the proxy creates a netpipe between itself and the server and queues the request. When the request has been sent, the client object enters the 'Read response' state, where the proxy enqueues the response from the server in the netpipe. Only when the whole response has been read into the netpipe buffer does the proxy enter the 'Process response' state. There the proxy simply dequeues the read information and enters the 'Send response to client' state, where the information is again enqueued in the netpipe connecting the proxy and the client.

When the reponse has been sent the proxy writes the page to cache.


next up previous
Next: Cache Management Up: Implementation Previous: Implementation
Magnus Bjornsson
1998-05-08