From d441e69fed5d0cb98549b10aa66c2637499021da Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Mon, 7 Aug 2006 02:53:28 +0000 Subject: [PATCH] Apache directory options --- lib/apache_options.dtl | 17 +++++++++++++++++ src/plugins/apache.sml | 31 +++++++++++++++++++++++++++++++ tests/testApache.dtl | 4 ++++ 3 files changed, 52 insertions(+) create mode 100644 lib/apache_options.dtl diff --git a/lib/apache_options.dtl b/lib/apache_options.dtl new file mode 100644 index 0000000..072e3f8 --- /dev/null +++ b/lib/apache_options.dtl @@ -0,0 +1,17 @@ +{{Per-directory options for Apache}} + +extern type apache_option; +{{See the + Apache documentation for what the options mean.}} + +extern val execCGI : apache_option; +extern val includesNOEXEC : apache_option; +extern val indexes : apache_option; + +extern val options : [apache_option] -> [^Vhost]; +{{Declare exactly the set of options in effect for the current scope.}} + +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.}} + diff --git a/src/plugins/apache.sml b/src/plugins/apache.sml index 4ea8f22..f497825 100644 --- a/src/plugins/apache.sml +++ b/src/plugins/apache.sml @@ -126,6 +126,11 @@ val cond_flag = fn (EVar "cond_nocase", _) => SOME "NC" | (EVar "ornext", _) => SOME "OR" | _ => NONE +val apache_option = fn (EVar "execCGI", _) => SOME "ExecCGI" + | (EVar "includesNOEXEC", _) => SOME "IncludesNOEXEC" + | (EVar "indexes", _) => SOME "Indexes" + | _ => NONE + val vhostsChanged = ref false @@ -330,5 +335,31 @@ val () = Env.action_two "errorDocument" write handler; write "\n")) +val () = Env.action_one "options" + ("options", Env.list apache_option) + (fn opts => + case opts of + [] => () + | _ => (write "\tOptions"; + app (fn opt => (write " "; write opt)) opts; + write "\n")) + +val () = Env.action_one "set_options" + ("options", Env.list apache_option) + (fn opts => + case opts of + [] => () + | _ => (write "\tOptions"; + app (fn opt => (write " +"; write opt)) opts; + write "\n")) + +val () = Env.action_one "unset_options" + ("options", Env.list apache_option) + (fn opts => + case opts of + [] => () + | _ => (write "\tOptions"; + app (fn opt => (write " -"; write opt)) opts; + write "\n")) end diff --git a/tests/testApache.dtl b/tests/testApache.dtl index c8438ff..ff45dfa 100644 --- a/tests/testApache.dtl +++ b/tests/testApache.dtl @@ -25,11 +25,15 @@ domain "hcoop.net" with proxyPass "/proxyLand" "http://localhost:1234/otherProxyLand"; proxyPassReverse "/proxyLand" "http://localhost:1234/otherProxyLand"; + options [execCGI]; + set_options [execCGI, indexes]; + scriptAlias "/cgi-bin/that-script" "/home/adamc/cgi/here-it-is"; errorDocument "404" "I just couldn't find it."; directory "/home/adamc/thisPlace" with rewriteRule "A" "B" []; + unset_options [includesNOEXEC]; end end; -- 2.20.1