Forum OpenACS Q&A: HTTP Last-Modified Header info in cr_write_content ?

Hi,

at our website 30% of the traffic are images that are dynamically
served out of the content repository (via a .vuh file that uses
cr_write_content). currently those images cannot be cached on the
client side very well.

it would be a nice feature to send http last-modified info with the
content and process client´s if-modfied-since header. i have looked
at the code and it does not look to difficult to implement, but the
structure of cr_write_content needs to be changed. (headers are
currently returned before info about the content is available)

so before i start changing cr_write_content i wanted to ask whether
someone else has done such an improvement or what others think about
it.

tia, peter

i found out the the current code in db_exec_lob (called by cr_write_content) uses ns_writefp to return the content of content_rep files that are saved in the file system. i think that this is rather inefficient, because it does not write a "last-modified" header and therefore it does not allow the browser to issue a conditional http request.

simply changing the current code to use ns_returnfile is better because then aolserver itself cares for the last-modified info and also processes the conditional client request. Requests to dynamic images in the content_rep can then be answered with 304 responses as well.

at my site i can already see the difference that makes in the server access log :)