Change setEnv arg
authorAdam Chlipala <adamc@hcoop.net>
Sat, 13 Oct 2007 13:27:07 +0000 (13:27 +0000)
committerAdam Chlipala <adamc@hcoop.net>
Sat, 13 Oct 2007 13:27:07 +0000 (13:27 +0000)
lib/mod_env.dtl
src/domain.sml
src/plugins/apache.sml

index 21f2021..305ef1f 100644 (file)
@@ -1,5 +1,5 @@
 {{Support for Apache's mod_env, which deals with UNIX environment variables}}
 
 {{Support for Apache's mod_env, which deals with UNIX environment variables}}
 
-extern val setEnv : no_spaces -> no_spaces -> [^Vhost];
+extern val setEnv : no_spaces -> no_newlines -> [^Vhost];
 {{See <a href="http://httpd.apache.org/docs/2.0/mod/mod_env.html#setenv">the
   Apache documentation</a>.}}
 {{See <a href="http://httpd.apache.org/docs/2.0/mod/mod_env.html#setenv">the
   Apache documentation</a>.}}
index c097128..01f7902 100644 (file)
@@ -114,10 +114,12 @@ val validGroup = validUser
 
 val _ = Env.type_one "no_spaces"
                     Env.string
 
 val _ = Env.type_one "no_spaces"
                     Env.string
-                    (CharVector.all (fn ch => not (Char.isSpace ch) andalso ch <> #"\"" andalso ch <> #"'"))
+                    (CharVector.all (fn ch => Char.isPrint ch andalso not (Char.isSpace ch)
+                                              andalso ch <> #"\"" andalso ch <> #"'"))
 val _ = Env.type_one "no_newlines"
                     Env.string
 val _ = Env.type_one "no_newlines"
                     Env.string
-                    (CharVector.all (fn ch => ch <> #"\n" andalso ch <> #"\r" andalso ch <> #"\"" andalso ch <> #"'"))
+                    (CharVector.all (fn ch => Char.isPrint ch andalso ch <> #"\n" andalso ch <> #"\r"
+                                              andalso ch <> #"\"" andalso ch <> #"'"))
 
 val _ = Env.type_one "ip"
        Env.string
 
 val _ = Env.type_one "ip"
        Env.string
index 167759f..29dc447 100644 (file)
@@ -887,7 +887,8 @@ val () = Env.action_two "setEnv"
         (fn (key, value) => (write "\tSetEnv \"";
                              write key;
                              write "\" \"";
         (fn (key, value) => (write "\tSetEnv \"";
                              write key;
                              write "\" \"";
-                             write value;
+                             write (String.translate (fn #"\"" => "\\\""
+                                                       | ch => str ch) value);
                              write "\"\n"))
 
 val () = Domain.registerResetLocal (fn () =>
                              write "\"\n"))
 
 val () = Domain.registerResetLocal (fn () =>