From: Adam Chlipala Date: Sat, 15 Dec 2007 01:13:21 +0000 (+0000) Subject: Add cgiExtension X-Git-Tag: release_2010-11-19~91 X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/commitdiff_plain/781ebc11c3ab9b359cd0ee1cc653bd8f223a0bd8?hp=cd04086681583dd3fcc95b6e12ba312054dc590e Add cgiExtension --- diff --git a/lib/apache_options.dtl b/lib/apache_options.dtl index a40105d..7becc15 100644 --- a/lib/apache_options.dtl +++ b/lib/apache_options.dtl @@ -32,3 +32,7 @@ extern val action : no_spaces -> location -> [^Vhost]; extern val addDefaultCharset : no_spaces -> [^Vhost]; {{See the Apache documentation.}} + +extern type file_extension; +extern val cgiExtension : file_extension -> [^Vhost]; +{{Ask for all files ending in a particular extension to be executed as CGI.}} diff --git a/src/plugins/apache.sml b/src/plugins/apache.sml index e81792a..617420a 100644 --- a/src/plugins/apache.sml +++ b/src/plugins/apache.sml @@ -111,6 +111,15 @@ fun ssl e = case e of | (EApp ((EVar "use_cert", _), s), _) => Option.map SOME (Env.string s) | _ => NONE +fun validExtension s = + size s > 0 + andalso size s < 20 + andalso CharVector.all (fn ch => Char.isAlphaNum ch orelse ch = #"_") s + +val _ = Env.type_one "file_extension" + Env.string + validExtension + val defaults = [("WebPlaces", (TList (TBase "web_place", dl), dl), (fn () => (EList (map webPlaceDefault Config.Apache.webNodes_default), dl))), @@ -706,6 +715,12 @@ val () = Env.action_one "unset_options" app (fn opt => (write " -"; write opt)) opts; write "\n")) +val () = Env.action_one "cgiExtension" + ("extension", Env.string) + (fn ext => (write "\tAddHandler cgi-script "; + write ext; + write "\n")) + val () = Env.action_one "directoryIndex" ("filenames", Env.list Env.string) (fn opts =>