ServerAlias
authorAdam Chlipala <adamc@hcoop.net>
Mon, 7 Aug 2006 03:11:10 +0000 (03:11 +0000)
committerAdam Chlipala <adamc@hcoop.net>
Mon, 7 Aug 2006 03:11:10 +0000 (03:11 +0000)
lib/apache.dtl
lib/apache_options.dtl
lib/domain.dtl
src/domain.sml
src/plugins/apache.sml
tests/testApache.dtl

index 70edc96..9e70f74 100644 (file)
@@ -25,3 +25,6 @@ extern val location : location -> ^Vhost & Location => [Vhost & !Location];
 extern val directory : your_path -> ^Vhost & Location => [Vhost & !Location];
 {{Set some configuration specific to a URI prefix or filesystem directory,
   respectively.}}
+
+extern val serverAlias : your_domain_host -> [Vhost];
+{{Give an alternate hostname for this vhost.}}
index 072e3f8..c678d47 100644 (file)
@@ -15,3 +15,6 @@ extern val set_options : [apache_option] -> [^Vhost];
 extern val unset_options : [apache_option] -> [^Vhost];
 {{Specify some options to be set or unset, leaving the rest as they are.}}
 
+extern val directoryIndex : [no_spaces] -> [^Vhost];
+{{Give the list of filenames to try for the default page of a directory, to be
+  considered in the order given.}}
index 0ab7716..34b6859 100644 (file)
@@ -18,6 +18,9 @@ extern type domain;
 extern type your_domain;
 {{A domain that you're allowed to configure}}
 
+extern type your_domain_host;
+{{Some host (as a fully-qualified domain name) in one of your domains}}
+
 extern type node;
 {{The name of a server controlled by domtool}}
 
index 71d448d..224755f 100644 (file)
@@ -71,6 +71,17 @@ fun yourPath path =
                                     orelse ch = #"-" orelse ch = #"_") path
     andalso SS.exists (fn s' => path = s' orelse String.isPrefix (s' ^ "/") path) (your_paths ())
 
+fun yourDomainHost s =
+    let
+       val (pref, suf) = Substring.splitl (fn ch => ch <> #".") (Substring.full s)
+    in
+       print ("pref[" ^ Substring.string pref ^ "] suf[" ^ Substring.string suf ^ "]\n");
+       Substring.size suf > 0
+       andalso validHost (Substring.string pref)
+       andalso yourDomain (Substring.string
+                              (Substring.slice (suf, 1, NONE)))
+    end
+
 val _ = Env.type_one "no_spaces"
                     Env.string
                     (CharVector.all (fn ch => not (Char.isSpace ch)))
@@ -94,6 +105,10 @@ val _ = Env.type_one "your_domain"
        Env.string
        yourDomain
 
+val _ = Env.type_one "your_domain_host"
+       Env.string
+       yourDomainHost
+
 val _ = Env.type_one "your_user"
        Env.string
        yourUser
index f497825..4887043 100644 (file)
@@ -208,7 +208,9 @@ val () = Env.containerV_one "vhost"
                                           file
                                       end)
                                   nodes;
-                write "\tSuexecUserGroup ";
+                write "\tServerName ";
+                write fullHost;
+                write "\n\tSuexecUserGroup ";
                 write user;
                 write " ";
                 write group;
@@ -362,4 +364,18 @@ val () = Env.action_one "unset_options"
                       app (fn opt => (write " -"; write opt)) opts;
                       write "\n"))
 
+val () = Env.action_one "directoryIndex"
+        ("filenames", Env.list Env.string)
+        (fn opts =>
+            (write "\tDirectoryIndex";
+             app (fn opt => (write " "; write opt)) opts;
+             write "\n"))
+
+val () = Env.action_one "serverAlias"
+        ("host", Env.string)
+        (fn host =>
+            (write "\tServerAlias ";
+             write host;
+             write "\n"))
+
 end
index ff45dfa..9c28fcd 100644 (file)
@@ -22,6 +22,8 @@ domain "hcoop.net" with
        end;
 
        vhost "proxy" with
+               serverAlias "proxy2.hcoop.net";
+
                proxyPass "/proxyLand" "http://localhost:1234/otherProxyLand";
                proxyPassReverse "/proxyLand" "http://localhost:1234/otherProxyLand";
 
@@ -39,6 +41,8 @@ domain "hcoop.net" with
 
        vhost "lists" with
                proxyPass "/mailman" "http://hcoop.net/cgi-bin/mailman";
-               alias "/doc/mailman" "/home/adamc/mailman"
+               alias "/doc/mailman" "/home/adamc/mailman";
+
+               directoryIndex ["index.sml", "index.h", "index.v"]
        end
 end