2 * Written by Richard W.M. Jones <rich@merjis.com>.
3 * Copyright (C) 2004 Merjis Ltd.
4 * $Id: hoststyle.ml,v 1.2 2004/09/07 13:40:10 rich Exp $
13 open Cocanwiki_template
15 let run r (q : cgi) (dbh : Dbi.connection) (hostid, _, _) _ =
17 let sth = dbh#prepare_cached "select css from hosts where id = ?" in
18 sth#execute [`Int hostid];
21 match sth#fetch1 () with
23 | [ `String css ] -> css
24 | _ -> assert false in
26 (* It's crucial, for speed of page delivery and rendering, to have
27 * an expires header for CSS. Even though this means that occasionally
28 * people will need to hit [Shift]+Reload, I'm going to set a
29 * medium-length expiry time on this resource.
31 Table.set (Request.headers_out r) "Expires" (Cgi_expires.expires_medium ());
33 q#header ~content_type:"text/css" ();