errorDocument outputs quotes as needed
authoradamch <adamch>
Sat, 8 Dec 2007 02:41:07 +0000 (02:41 +0000)
committeradamch <adamch>
Sat, 8 Dec 2007 02:41:07 +0000 (02:41 +0000)
src/plugins/apache.sml

index 7cdc613..c4b684f 100644 (file)
@@ -653,12 +653,24 @@ val () = Env.action_two "scriptAlias"
 val () = Env.action_two "errorDocument"
         ("code", Env.string, "handler", Env.string)
         (fn (code, handler) =>
-            (write "\tErrorDocument\t";
-             write code;
-             write " ";
-             write handler;
-             write "\n"))
+            let
+                val hasSpaces = CharVector.exists Char.isSpace handler
 
+                fun maybeQuote () =
+                    if hasSpaces then
+                        write "\""
+                    else
+                        ()
+            in
+                write "\tErrorDocument\t";
+                write code;
+                write " ";
+                maybeQuote ();
+                write handler;
+                maybeQuote ();
+                write "\n"
+            end)
+                         
 val () = Env.action_one "options"
         ("options", Env.list apache_option)
         (fn opts =>