1 (* HCoop
Domtool (http
://hcoop
.sourceforge
.net
/)
2 * Copyright (c
) 2006-2007, Adam Chlipala
4 * This program is free software
; you can redistribute it
and/or
5 * modify it under the terms
of the GNU General Public License
6 * as published by the Free Software Foundation
; either version
2
7 * of the License
, or (at your option
) any later version
.
9 * This program is distributed
in the hope that it will be useful
,
10 * but WITHOUT ANY WARRANTY
; without even the implied warranty
of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
. See the
12 * GNU General Public License for more details
.
14 * You should have received a copy
of the GNU General Public License
15 * along
with this program
; if not
, write to the Free Software
16 * Foundation
, Inc
., 51 Franklin Street
, Fifth Floor
, Boston
, MA
02110-1301, USA
.
19 (* Apache HTTPD handling
*)
21 structure Apache
:> APACHE
= struct
25 val _
= Env
.type_one
"web_node"
28 List.exists (fn (x
, _
) => x
= node
) Config
.Apache
.webNodes_all
29 orelse (Domain
.hasPriv
"www"
30 andalso List.exists (fn (x
, _
) => x
= node
) Config
.Apache
.webNodes_admin
))
32 val _
= Env
.registerFunction ("web_node_to_node",
36 val _
= Env
.type_one
"proxy_port"
40 val _
= Env
.type_one
"proxy_target"
44 fun default () = List.exists (fn s
' => s
= s
') Config
.Apache
.proxyTargets
46 case String.fields (fn ch
=> ch
= #
":") s
of
47 ["http", "//localhost", rest
] =>
48 (case String.fields (fn ch
=> ch
= #
"/") rest
of
50 (case Int.fromString port
of
52 | SOME n
=> n
> 1024 orelse default ())
57 val _
= Env
.type_one
"rewrite_arg"
59 (CharVector
.all
Char.isAlphaNum
)
61 val _
= Env
.type_one
"suexec_flag"
63 (fn b
=> b
orelse Domain
.hasPriv
"www")
66 size s
> 0 andalso size s
< 1000 andalso CharVector
.all
67 (fn ch
=> Char.isAlphaNum ch
73 val _
= Env
.type_one
"location"
77 fun validCert s
= Acl
.query
{user
= Domain
.getUser (),
81 val _
= Env
.type_one
"ssl_cert_path"
86 (EVar
"no_ssl", _
) => SOME NONE
87 |
(EApp ((EVar
"use_cert", _
), s
), _
) => Option
.map
SOME (Env
.string s
)
90 val dl
= ErrorMsg
.dummyLoc
92 val _
= Defaults
.registerDefault ("WebNodes",
93 (TList (TBase
"web_node", dl
), dl
),
94 (fn () => (EList (map (fn s
=> (EString s
, dl
)) Config
.Apache
.webNodes_default
), dl
)))
96 val _
= Defaults
.registerDefault ("SSL",
98 (fn () => (EVar
"no_ssl", dl
)))
100 val _
= Defaults
.registerDefault ("User",
101 (TBase
"your_user", dl
),
102 (fn () => (EString (Domain
.getUser ()), dl
)))
104 val _
= Defaults
.registerDefault ("Group",
105 (TBase
"your_group", dl
),
106 (fn () => (EString
"nogroup", dl
)))
108 val _
= Defaults
.registerDefault ("DocumentRoot",
109 (TBase
"your_path", dl
),
110 (fn () => (EString (Domain
.homedir () ^
"/" ^ Config
.Apache
.public_html
), dl
)))
112 val _
= Defaults
.registerDefault ("ServerAdmin",
114 (fn () => (EString (Domain
.getUser () ^
"@" ^ Config
.defaultDomain
), dl
)))
116 val _
= Defaults
.registerDefault ("SuExec",
117 (TBase
"suexec_flag", dl
),
118 (fn () => (EVar
"true", dl
)))
120 val redirect_code
= fn (EVar
"temp", _
) => SOME
"temp"
121 |
(EVar
"permanent", _
) => SOME
"permanent"
122 |
(EVar
"seeother", _
) => SOME
"seeother"
123 |
(EVar
"redir300", _
) => SOME
"300"
124 |
(EVar
"redir301", _
) => SOME
"301"
125 |
(EVar
"redir302", _
) => SOME
"302"
126 |
(EVar
"redir303", _
) => SOME
"303"
127 |
(EVar
"redir304", _
) => SOME
"304"
128 |
(EVar
"redir305", _
) => SOME
"305"
129 |
(EVar
"redir307", _
) => SOME
"307"
132 val flag
= fn (EVar
"redirect", _
) => SOME
"R"
133 |
(EVar
"forbidden", _
) => SOME
"F"
134 |
(EVar
"gone", _
) => SOME
"G"
135 |
(EVar
"last", _
) => SOME
"L"
136 |
(EVar
"chain", _
) => SOME
"C"
137 |
(EVar
"nosubreq", _
) => SOME
"NS"
138 |
(EVar
"nocase", _
) => SOME
"NC"
139 |
(EVar
"qsappend", _
) => SOME
"QSA"
140 |
(EVar
"noescape", _
) => SOME
"NE"
141 |
(EVar
"passthrough", _
) => SOME
"PT"
142 |
(EApp ((EVar
"mimeType", _
), e
), _
) =>
143 Option
.map (fn s
=> "T=" ^ s
) (Env
.string e
)
144 |
(EApp ((EVar
"redirectWith", _
), e
), _
) =>
145 Option
.map (fn s
=> "R=" ^ s
) (redirect_code e
)
146 |
(EApp ((EVar
"skip", _
), e
), _
) =>
147 Option
.map (fn n
=> "S=" ^
Int.toString n
) (Env
.int e
)
148 |
(EApp ((EApp ((EVar
"env", _
), e1
), _
), e2
), _
) =>
149 (case Env
.string e1
of
151 | SOME s1
=> Option
.map (fn s2
=> "E=" ^ s1 ^
":" ^ s2
)
156 val cond_flag
= fn (EVar
"cond_nocase", _
) => SOME
"NC"
157 |
(EVar
"ornext", _
) => SOME
"OR"
160 val apache_option
= fn (EVar
"execCGI", _
) => SOME
"ExecCGI"
161 |
(EVar
"includesNOEXEC", _
) => SOME
"IncludesNOEXEC"
162 |
(EVar
"indexes", _
) => SOME
"Indexes"
165 val autoindex_width
= fn (EVar
"autofit", _
) => SOME
"*"
166 |
(EApp ((EVar
"characters", _
), n
), _
) =>
167 Option
.map
Int.toString (Env
.int n
)
170 val autoindex_option
= fn (EApp ((EVar
"descriptionWidth", _
), w
), _
) =>
171 Option
.map (fn w
=> ("DescriptionWidth", SOME w
))
173 |
(EVar
"fancyIndexing", _
) => SOME ("FancyIndexing", NONE
)
174 |
(EVar
"foldersFirst", _
) => SOME ("FoldersFirst", NONE
)
175 |
(EVar
"htmlTable", _
) => SOME ("HTMLTable", NONE
)
176 |
(EVar
"iconsAreLinks", _
) => SOME ("IconsAreLinks", NONE
)
177 |
(EApp ((EVar
"iconHeight", _
), n
), _
) =>
178 Option
.map (fn w
=> ("IconHeight", SOME (Int.toString w
)))
180 |
(EApp ((EVar
"iconWidth", _
), n
), _
) =>
181 Option
.map (fn w
=> ("IconWidth", SOME (Int.toString w
)))
183 |
(EVar
"ignoreCase", _
) => SOME ("IgnoreCase", NONE
)
184 |
(EVar
"ignoreClient", _
) => SOME ("IgnoreClient", NONE
)
185 |
(EApp ((EVar
"nameWidth", _
), w
), _
) =>
186 Option
.map (fn w
=> ("NameWidth", SOME w
))
188 |
(EVar
"scanHtmlTitles", _
) => SOME ("ScanHTMLTitles", NONE
)
189 |
(EVar
"suppressColumnSorting", _
) => SOME ("SuppressColumnSorting", NONE
)
190 |
(EVar
"suppressDescription", _
) => SOME ("SuppressDescription", NONE
)
191 |
(EVar
"suppressHtmlPreamble", _
) => SOME ("SuppressHTMLPreamble", NONE
)
192 |
(EVar
"suppressIcon", _
) => SOME ("SuppressIcon", NONE
)
193 |
(EVar
"suppressLastModified", _
) => SOME ("SuppressLastModified", NONE
)
194 |
(EVar
"suppressRules", _
) => SOME ("SuppressRules", NONE
)
195 |
(EVar
"suppressSize", _
) => SOME ("SuppressSize", NONE
)
196 |
(EVar
"trackModified", _
) => SOME ("TrackModified", NONE
)
197 |
(EVar
"versionSort", _
) => SOME ("VersionSort", NONE
)
198 |
(EVar
"xhtml", _
) => SOME ("XHTML", NONE
)
202 val vhostsChanged
= ref
false
203 val logDeleted
= ref
false
205 val () = Slave
.registerPreHandler
206 (fn () => (vhostsChanged
:= false;
207 logDeleted
:= false))
209 fun findVhostUser fname
=
211 val inf
= TextIO.openIn fname
214 case TextIO.inputLine inf
of
217 if String.isPrefix
"# Owner: " line
then
218 case String.tokens
Char.isSpace line
of
219 [_
, _
, user
] => SOME user
225 before TextIO.closeIn inf
228 val webNodes_full
= Config
.Apache
.webNodes_all @ Config
.Apache
.webNodes_admin
230 fun isVersion1 node
=
231 List.exists (fn (n
, {version
= ConfigTypes
.APACHE_1_3
, ...}) => n
= node
232 | _
=> false) webNodes_full
234 fun imVersion1 () = isVersion1 (Slave
.hostname ())
237 List.exists (fn (n
, {auth
= ConfigTypes
.MOD_WAKLOG
, ...}) => n
= node
238 | _
=> false) webNodes_full
240 fun down () = if imVersion1 () then Config
.Apache
.down1
else Config
.Apache
.down
241 fun undown () = if imVersion1 () then Config
.Apache
.undown1
else Config
.Apache
.undown
242 fun reload () = if imVersion1 () then Config
.Apache
.reload1
else Config
.Apache
.reload
244 fun logDir
{user
, node
, vhostId
} =
245 String.concat
[Config
.Apache
.logDirOf (isVersion1 node
) user
,
251 val () = Slave
.registerFileHandler (fn fs
=>
253 val spl
= OS
.Path
.splitDirFile (#file fs
)
255 if String.isSuffix
".vhost" (#file spl
)
256 orelse String.isSuffix
".vhost_ssl" (#file spl
) then let
257 val realVhostFile
= OS
.Path
.joinDirFile
258 {dir
= Config
.Apache
.confDir
,
261 val user
= findVhostUser (#file fs
)
262 val oldUser
= findVhostUser realVhostFile
264 if (oldUser
= NONE
andalso #action fs
<> Slave
.Add
)
265 orelse (user
= NONE
andalso #action fs
<> Slave
.Delete
) then
266 print ("Can't find user in " ^ #file fs ^
" or " ^ realVhostFile ^
"! Taking no action.\n")
269 val vhostId
= if OS
.Path
.ext (#file spl
) = SOME
"vhost_ssl" then
270 OS
.Path
.base (#file spl
) ^
".ssl"
272 OS
.Path
.base (#file spl
)
274 fun realLogDir user
=
275 logDir
{user
= valOf user
,
276 node
= Slave
.hostname (),
279 vhostsChanged
:= true;
285 (ignore (OS
.Process
.system (down ()));
287 ignore (OS
.Process
.system (Config
.rm
290 ignore (OS
.Process
.system (Config
.rm
292 ^ realLogDir oldUser
)))
295 val rld
= realLogDir user
297 ignore (OS
.Process
.system (Config
.cp
302 if Posix
.FileSys
.access (rld
, []) then
309 (ignore (OS
.Process
.system (Config
.cp
314 if user
<> oldUser
then
316 val old
= realLogDir oldUser
317 val rld
= realLogDir user
322 (ignore (OS
.Process
.system (down ()));
324 ignore (OS
.Process
.system (Config
.rm
326 ^ realLogDir oldUser
));
327 if Posix
.FileSys
.access (rld
, []) then
340 val () = Slave
.registerPostHandler
342 (if !vhostsChanged
then
343 Slave
.shellF ([if !logDeleted
then undown () else reload ()],
344 fn cl
=> "Error reloading Apache with " ^ cl
)
348 val vhostFiles
: (string * TextIO.outstream
) list ref
= ref
[]
349 fun write
' s
= app (fn (node
, file
) => TextIO.output (file
, s node
)) (!vhostFiles
)
350 fun write s
= app (fn (_
, file
) => TextIO.output (file
, s
)) (!vhostFiles
)
352 val rewriteEnabled
= ref
false
353 val localRewriteEnabled
= ref
false
354 val currentVhost
= ref
""
355 val currentVhostId
= ref
""
356 val sslEnabled
= ref
false
358 val pre
= ref (fn _
: {user
: string, nodes
: string list
, id
: string, hostname
: string} => ())
363 pre
:= (fn x
=> (old x
; f x
))
366 val post
= ref (fn () => ())
371 post
:= (fn () => (old (); f ()))
374 val aliaser
= ref (fn _
: string => ())
375 fun registerAliaser f
=
379 aliaser
:= (fn x
=> (old x
; f x
))
382 val () = Env
.containerV_one
"vhost"
386 val nodes
= Env
.env (Env
.list Env
.string) (env
, "WebNodes")
388 val ssl
= Env
.env
ssl (env
, "SSL")
389 val user
= Env
.env Env
.string (env
, "User")
390 val group
= Env
.env Env
.string (env
, "Group")
391 val docroot
= Env
.env Env
.string (env
, "DocumentRoot")
392 val sadmin
= Env
.env Env
.string (env
, "ServerAdmin")
393 val suexec
= Env
.env Env
.bool (env
, "SuExec")
395 val fullHost
= host ^
"." ^ Domain
.currentDomain ()
396 val vhostId
= fullHost ^
(if Option
.isSome ssl
then ".ssl" else "")
397 val confFile
= fullHost ^
(if Option
.isSome ssl
then ".vhost_ssl" else ".vhost")
399 currentVhost
:= fullHost
;
400 currentVhostId
:= vhostId
;
401 sslEnabled
:= Option
.isSome ssl
;
403 rewriteEnabled
:= false;
404 localRewriteEnabled
:= false;
405 vhostFiles
:= map (fn node
=>
407 val file
= Domain
.domainFile
{node
= node
,
410 val ld
= logDir
{user
= user
, node
= node
, vhostId
= vhostId
}
412 TextIO.output (file
, "# Owner: ");
413 TextIO.output (file
, user
);
414 TextIO.output (file
, "\n<VirtualHost ");
415 TextIO.output (file
, Domain
.nodeIp node
);
416 TextIO.output (file
, ":");
417 TextIO.output (file
, case ssl
of
420 TextIO.output (file
, ">\n");
421 TextIO.output (file
, "\tErrorLog ");
422 TextIO.output (file
, ld
);
423 TextIO.output (file
, "/error.log\n\tCustomLog ");
424 TextIO.output (file
, ld
);
425 TextIO.output (file
, "/access.log combined\n");
426 TextIO.output (file
, "\tServerName ");
427 TextIO.output (file
, fullHost
);
429 (fn dom
=> (TextIO.output (file
, "\n\tServerAlias ");
430 TextIO.output (file
, host
);
431 TextIO.output (file
, ".");
432 TextIO.output (file
, dom
)))
433 (Domain
.currentAliasDomains ());
436 if isVersion1 node
then
437 (TextIO.output (file
, "\n\tUser ");
438 TextIO.output (file
, user
);
439 TextIO.output (file
, "\n\tGroup ");
440 TextIO.output (file
, group
))
442 (TextIO.output (file
, "\n\tSuexecUserGroup ");
443 TextIO.output (file
, user
);
444 TextIO.output (file
, " ");
445 TextIO.output (file
, group
))
449 if isWaklog node
then
450 (TextIO.output (file
, "\n\tWaklogEnabled on\n\tWaklogLocationPrincipal ");
451 TextIO.output (file
, user
);
452 TextIO.output (file
, "/daemon@HCOOP.NET /etc/keytabs/user.daemon/");
453 TextIO.output (file
, user
))
457 TextIO.output (file
, "\n\tDAVLockDB /var/lock/apache2/dav/");
458 TextIO.output (file
, user
);
459 TextIO.output (file
, "/DAVLock");
464 write
"\n\tDocumentRoot ";
466 write
"\n\tServerAdmin ";
470 (write
"\n\tSSLEngine on\n\tSSLCertificateFile ";
474 !pre
{user
= user
, nodes
= nodes
, id
= vhostId
, hostname
= fullHost
};
475 app (fn dom
=> !aliaser (host ^
"." ^ dom
)) (Domain
.currentAliasDomains ())
478 write
"</VirtualHost>\n";
479 app (TextIO.closeOut
o #
2) (!vhostFiles
)))
481 val inLocal
= ref
false
483 val () = Env
.container_one
"location"
484 ("prefix", Env
.string)
486 (write
"\t<Location ";
490 fn () => (write
"\t</Location>\n";
492 localRewriteEnabled
:= false))
494 val () = Env
.container_one
"directory"
495 ("directory", Env
.string)
497 (write
"\t<Directory ";
501 fn () => (write
"\t</Directory>\n";
503 localRewriteEnabled
:= false))
505 fun checkRewrite () =
507 if !rewriteEnabled
orelse !localRewriteEnabled
then
510 (write
"\tRewriteEngine on\n";
511 localRewriteEnabled
:= true)
512 else if !rewriteEnabled
then
515 (write
"\tRewriteEngine on\n";
516 rewriteEnabled
:= true)
518 val () = Env
.action_three
"localProxyRewrite"
519 ("from", Env
.string, "to", Env
.string, "port", Env
.int)
520 (fn (from
, to
, port
) =>
522 write
"\tRewriteRule\t";
524 write
"\thttp://localhost:";
525 write (Int.toString port
);
530 val () = Env
.action_two
"proxyPass"
531 ("from", Env
.string, "to", Env
.string)
533 (write
"\tProxyPass\t";
539 val () = Env
.action_two
"proxyPassReverse"
540 ("from", Env
.string, "to", Env
.string)
542 (write
"\tProxyPassReverse\t";
548 val () = Env
.action_three
"rewriteRule"
549 ("from", Env
.string, "to", Env
.string, "flags", Env
.list flag
)
550 (fn (from
, to
, flags
) =>
552 write
"\tRewriteRule\t";
558 | flag
::rest
=> (write
" [";
560 app (fn flag
=> (write
",";
565 val () = Env
.action_three
"rewriteCond"
566 ("test", Env
.string, "pattern", Env
.string, "flags", Env
.list cond_flag
)
567 (fn (from
, to
, flags
) =>
569 write
"\tRewriteCond\t";
575 | flag
::rest
=> (write
" [";
577 app (fn flag
=> (write
",";
582 val () = Env
.action_one
"rewriteBase"
583 ("prefix", Env
.string)
586 write
"\tRewriteBase\t";
590 val () = Env
.action_one
"rewriteLogLevel"
594 write
"\tRewriteLog ";
596 write
"/rewrite.log\n\tRewriteLogLevel ";
597 write (Int.toString level
);
600 val () = Env
.action_two
"alias"
601 ("from", Env
.string, "to", Env
.string)
609 val () = Env
.action_two
"scriptAlias"
610 ("from", Env
.string, "to", Env
.string)
612 (write
"\tScriptAlias\t";
618 val () = Env
.action_two
"errorDocument"
619 ("code", Env
.string, "handler", Env
.string)
620 (fn (code
, handler
) =>
621 (write
"\tErrorDocument\t";
627 val () = Env
.action_one
"options"
628 ("options", Env
.list apache_option
)
632 | _
=> (write
"\tOptions";
633 app (fn opt
=> (write
" "; write opt
)) opts
;
636 val () = Env
.action_one
"set_options"
637 ("options", Env
.list apache_option
)
641 | _
=> (write
"\tOptions";
642 app (fn opt
=> (write
" +"; write opt
)) opts
;
645 val () = Env
.action_one
"unset_options"
646 ("options", Env
.list apache_option
)
650 | _
=> (write
"\tOptions";
651 app (fn opt
=> (write
" -"; write opt
)) opts
;
654 val () = Env
.action_one
"directoryIndex"
655 ("filenames", Env
.list Env
.string)
657 (write
"\tDirectoryIndex";
658 app (fn opt
=> (write
" "; write opt
)) opts
;
661 val () = Env
.action_one
"serverAliasHost"
664 (write
"\tServerAlias ";
669 val () = Env
.action_one
"serverAlias"
675 val full
= host ^
"." ^ dom
677 write
"\tServerAlias ";
682 (Domain
.currentDomains ())))
684 val () = Env
.action_none
"serverAliasDefault"
688 (write
"\tServerAlias ";
692 (Domain
.currentDomains ())))
694 val authType
= fn (EVar
"basic", _
) => SOME
"basic"
695 |
(EVar
"digest", _
) => SOME
"digest"
696 |
(EVar
"kerberos", _
) => SOME
"kerberos"
699 fun allowAuthType
"kerberos" = !sslEnabled
700 | allowAuthType _
= true
702 val () = Env
.action_one
"authType"
705 if allowAuthType ty
then
706 (write
"\tAuthType ";
711 write
"\tKrbMethodNegotiate off\n\tKrbMethodK5Passwd on\n\tKrbVerifyKDC off\n\tKrbAuthRealms HCOOP.NET\n\tKrbSaveCredentials on\n"
714 print
"WARNING: Skipped Kerberos authType because this isn't an SSL vhost.\n")
716 val () = Env
.action_one
"authName"
719 (write
"\tAuthName \"";
723 val () = Env
.action_one
"authUserFile"
726 (write
"\tAuthUserFile ";
730 val () = Env
.action_none
"requireValidUser"
731 (fn () => write
"\tRequire valid-user\n")
733 val () = Env
.action_one
"requireUser"
734 ("users", Env
.list Env
.string)
738 | _
=> (write
"\tRequire user";
739 app (fn name
=> (write
" "; write name
)) names
;
742 val () = Env
.action_one
"requireGroup"
743 ("groups", Env
.list Env
.string)
747 | _
=> (write
"\tRequire group";
748 app (fn name
=> (write
" "; write name
)) names
;
751 val () = Env
.action_none
"orderAllowDeny"
752 (fn () => write
"\tOrder allow,deny\n")
754 val () = Env
.action_none
"orderDenyAllow"
755 (fn () => write
"\tOrder deny,allow\n")
757 val () = Env
.action_none
"allowFromAll"
758 (fn () => write
"\tAllow from all\n")
760 val () = Env
.action_one
"allowFrom"
761 ("entries", Env
.list Env
.string)
765 | _
=> (write
"\tAllow from";
766 app (fn name
=> (write
" "; write name
)) names
;
769 val () = Env
.action_none
"denyFromAll"
770 (fn () => write
"\tDeny from all\n")
772 val () = Env
.action_one
"denyFrom"
773 ("entries", Env
.list Env
.string)
777 | _
=> (write
"\tDeny from";
778 app (fn name
=> (write
" "; write name
)) names
;
781 val () = Env
.action_none
"satisfyAll"
782 (fn () => write
"\tSatisfy all\n")
784 val () = Env
.action_none
"satisfyAny"
785 (fn () => write
"\tSatisfy any\n")
787 val () = Env
.action_one
"forceType"
789 (fn ty
=> (write
"\tForceType ";
793 val () = Env
.action_none
"forceTypeOff"
794 (fn () => write
"\tForceType None\n")
796 val () = Env
.action_two
"action"
797 ("what", Env
.string, "how", Env
.string)
798 (fn (what
, how
) => (write
"\tAction ";
804 val () = Env
.action_one
"addDefaultCharset"
805 ("charset", Env
.string)
806 (fn ty
=> (write
"\tAddDefaultCharset ";
810 (*val () = Env
.action_one
"davSvn"
812 (fn path
=> (write
"\tDAV svn\n\tSVNPath ";
816 val () = Env
.action_one
"authzSvnAccessFile"
818 (fn path
=> (write
"\tAuthzSVNAccessFile ";
822 val () = Env
.action_none
"davFilesystem"
823 (fn path
=> write
"\tDAV filesystem\n")
825 val () = Env
.action_two
"addDescription"
826 ("description", Env
.string, "patterns", Env
.list Env
.string)
830 | _
=> (write
"\tAddDescription \"";
831 write (String.toString desc
);
833 app (fn pat
=> (write
" "; write pat
)) pats
;
836 val () = Env
.action_one
"indexOptions"
837 ("options", Env
.list autoindex_option
)
841 | _
=> (write
"\tIndexOptions";
842 app (fn (opt
, arg
) =>
845 Option
.app (fn arg
=>
846 (write
"="; write arg
)) arg
)) opts
;
849 val () = Env
.action_one
"set_indexOptions"
850 ("options", Env
.list autoindex_option
)
854 | _
=> (write
"\tIndexOptions";
855 app (fn (opt
, arg
) =>
858 Option
.app (fn arg
=>
859 (write
"="; write arg
)) arg
)) opts
;
862 val () = Env
.action_one
"unset_indexOptions"
863 ("options", Env
.list autoindex_option
)
867 | _
=> (write
"\tIndexOptions";
873 val () = Env
.action_one
"headerName"
875 (fn name
=> (write
"\tHeaderName ";
879 val () = Env
.action_one
"readmeName"
881 (fn name
=> (write
"\tReadmeName ";
885 val () = Env
.action_two
"setEnv"
886 ("key", Env
.string, "value", Env
.string)
887 (fn (key
, value
) => (write
"\tSetEnv \"";
890 write (String.translate (fn #
"\"" => "\\\""
891 | ch
=> str ch
) value
);
894 val () = Domain
.registerResetLocal (fn () =>
895 ignore (OS
.Process
.system (Config
.rm ^
" -rf /var/domtool/vhosts/*")))