From: rich Date: Thu, 14 Oct 2004 18:04:56 +0000 (+0000) Subject: Somewhat fundamental and experimental change to the handling of X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=afa89a4ad39c3d707647bad47b7411cb62d46db6;p=cocanwiki.git Somewhat fundamental and experimental change to the handling of hostnames. The host.hostname field is now always the actual hostname that the user arrived on. The host.canonical_hostname field is the canonical hostname. --- diff --git a/scripts/cocanwiki.ml b/scripts/cocanwiki.ml index 7114c2c..8bd50b8 100644 --- a/scripts/cocanwiki.ml +++ b/scripts/cocanwiki.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: cocanwiki.ml,v 1.17 2004/10/11 14:13:04 rich Exp $ + * $Id: cocanwiki.ml,v 1.18 2004/10/14 18:04:56 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,6 +36,7 @@ let _get_dbh r = Pool.get r "cocanwiki" (* The "host object". *) type host_t = { hostname : string; + canonical_hostname : string; edit_anon : bool; view_anon : bool } @@ -95,7 +96,7 @@ let register_script ?(restrict = []) ?(anonymous = true) run = (* Get the host ID, by comparing the Host: header with the hostnames * table in the database. *) - let hostid, hostname, edit_anon, view_anon = + let hostid, hostname, canonical_hostname, edit_anon, view_anon = let hostname = try Request.hostname r with Not_found -> failwith "No ``Host:'' header in request" in let hostname = String.lowercase hostname in @@ -109,9 +110,9 @@ let register_script ?(restrict = []) ?(anonymous = true) run = try (match sth#fetch1 () with - [ `Int id; `String hostname; + [ `Int id; `String canonical_hostname; `Bool edit_anon; `Bool view_anon ] -> - id, hostname, edit_anon, view_anon + id, hostname, canonical_hostname, edit_anon, view_anon | _ -> assert false) with Not_found -> @@ -120,6 +121,7 @@ let register_script ?(restrict = []) ?(anonymous = true) run = (* Create the host object. *) let host = { hostname = hostname; + canonical_hostname = canonical_hostname; edit_anon = edit_anon; view_anon = view_anon } in