41.6 Web server

Class Http/Server models behavior of a HTTP server. Its configuration is very simple. All that a user needs to do is to create a server, attach a PagePool and wait:

        set server [new Http/Server $ns $node] # attach \$server to \$node;
        $server set-page-generator $pgp # attach a page pool;

An Http/Server object waits for incoming requests after simulation starts. Usually clients and caches initiates connection to an Http/Server. But it still has its own connect method, which allows an Http/Server object to actively connect to a certain cache (or client). Sometimes this is useful, as explained in Test/TLC1::set-groups{} in ns/tcl/test/test-suite-webcache.tcl.

An Http/Server object accepts two types of requests: GET and IMS. GET request models normal client requests. For every GET request, it returns the attributes of the requested page. IMS request models If-Modified-Since used by TTL algorithms for cache consistency. For every IMS (If-Modified-Since) request, it compares the page modification time given in the request and that of the page in its PagePool. If the time indicated in the request is older, it sends back a response with very small size, otherwise it returns all of the page attributes with response size equal the real page size.

Tom Henderson 2011-11-05