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