More Apache directory option stuff
authorAdam Chlipala <adamc@hcoop.net>
Mon, 7 Aug 2006 04:02:12 +0000 (04:02 +0000)
committerAdam Chlipala <adamc@hcoop.net>
Mon, 7 Aug 2006 04:02:12 +0000 (04:02 +0000)
lib/apache_options.dtl
src/main.sml
src/parse.sml
src/plugins/apache.sml
tests/testApache.dtl

index c678d47..83f3465 100644 (file)
@@ -18,3 +18,16 @@ extern val unset_options : [apache_option] -> [^Vhost];
 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.}}
+
+extern val forceType : no_spaces -> [Location];
+extern val forceTypeOff : [Location];
+{{Force all files in the current directory to be served with the given MIME
+  type.}}
+
+extern val action : no_spaces -> location -> [^Vhost];
+{{See <a href="http://httpd.apache.org/docs/2.0/mod/mod_actions.html#action">the
+  Apache documentation</a>.}}
+
+extern val addDefaultCharset : no_spaces -> [^Vhost];
+{{See <a href="http://httpd.apache.org/docs/2.0/mod/core.html#adddefaultcharset">the
+  Apache documentation</a>.}}
index 22577ad..705b20a 100644 (file)
@@ -89,6 +89,7 @@ fun check fname =
            (b, NONE)
        else
            let
+               val _ = ErrorMsg.reset ()
                val prog = Parse.parse fname
            in
                if !ErrorMsg.anyErrors then
index 90cf07c..00fefca 100644 (file)
@@ -29,7 +29,7 @@ structure Parse :> PARSE =
 
   (* The main parsing routine *)
   fun parse filename =
-    let val _ = ErrorMsg.fileName := filename
+    let val _ = (ErrorMsg.fileName := filename)
        val file = TextIO.openIn filename
        fun get _ = TextIO.input file
        fun parseerror(s,p1,p2) = ErrorMsg.error (SOME (p1,p2)) s
index 7689860..23f8dd3 100644 (file)
@@ -460,4 +460,27 @@ val () = Env.action_none "satisfyAll"
 val () = Env.action_none "satisfyAny"
         (fn () => write "\tSatisfy any\n")
 
+val () = Env.action_one "forceType"
+        ("type", Env.string)
+        (fn ty => (write "\tForceType ";
+                   write ty;
+                   write "\n"))
+
+val () = Env.action_none "forceTypeOff"
+        (fn () => write "\tForceType None\n")
+
+val () = Env.action_two "action"
+        ("what", Env.string, "how", Env.string)
+        (fn (what, how) => (write "\tAction ";
+                            write what;
+                            write " ";
+                            write how;
+                            write "\n"))
+
+val () = Env.action_one "addDefaultCharset"
+        ("charset", Env.string)
+        (fn ty => (write "\tAddDefaultCharset ";
+                   write ty;
+                   write "\n"))
+
 end
index acade80..e637d69 100644 (file)
@@ -6,7 +6,7 @@ domain "hcoop.net" with
                DocumentRoot = "/home/adamc/html";
                ServerAdmin = "adamc@hcoop.net"
        with
-
+               addDefaultCharset "mumbo-jumbo/incomprehensible"
        end;
 
        vhost "members" where
@@ -33,6 +33,8 @@ domain "hcoop.net" with
                scriptAlias "/cgi-bin/that-script" "/home/adamc/cgi/here-it-is";
                errorDocument "404" "I just couldn't find it.";
 
+               action "text/plain" "/cgi-bin/display";
+
                directory "/home/adamc/thisPlace" with
                        rewriteRule "A" "B" [];
                        unset_options [includesNOEXEC];
@@ -43,6 +45,10 @@ domain "hcoop.net" with
                proxyPass "/mailman" "http://hcoop.net/cgi-bin/mailman";
                alias "/doc/mailman" "/home/adamc/mailman";
 
+               location "/the-citadel" with
+                       forceTypeOff;
+               end;
+
                directoryIndex ["index.sml", "index.h", "index.v"]
        end;
 
@@ -56,6 +62,8 @@ domain "hcoop.net" with
                        requireUser ["freddy", "flicky"];
                        requireGroup ["awesome"];
 
+                       forceType "text/html";
+
                        orderDenyAllow;
                        satisfyAny
                end