Content-lengths of dynamic objects

[Citation date: Mon, 8 May 1995 10:56:06 +0500]
RST == Robert S Thau <rst@ai.mit.edu>

  RST> [...] The server doesn't know the content-length of dynamically
  RST> generated objects (i.e., those resulting from processing of
  RST> server-side includes or invocation of a CGI script), so it *can't*
  RST> report content-length for those items.

I'd like to pick a minor nit here; while your analysis of Srivatsa's problem
is likely correct (server-side includes turned on for html files), I would
point out that the phrase "dynamic object" applies to more than just
includes and CGI scripts.  Reasonable implementations of dynamic objects
should not have this problem.  My web is 100% dynamic, but always (I hope)
reports correct content-lengths (as well as Title and Links, as well); it is
simply an implementation issue.

For the curious, I've done this by having all objects implement two standard
methods: 'compute_lastmod' and 'render'.  When I want to render an object, I
first instantiate the object, and invoke 'compute_lastmod' on it.  I compare
the return value with the timestamp of an on-disk copy of the last
rendering.  If they are the same, I simply serve the file off disk; if not,
I invoke method 'render', take the output of that and dump it in the disk
file, touch the file appropriately, and then have the server serve the file
off disk.  Dynamic objects with local render caching, with the added bonus
of correct Content-Lengths.

-- 
Jared_Rhine@hmc.edu / HMC / <URL:http://www.hmc.edu/~jared/home>

"A hundred thousand lemmings can't be wrong."
        -- attributed to Larry Sheldon, Jr.

Received on Monday, 8 May 1995 12:49:42 UTC