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
= [("WebNodes",
93 (TList (TBase
"web_node", dl
), dl
),
94 (fn () => (EList (map (fn s
=> (EString s
, dl
)) Config
.Apache
.webNodes_default
), dl
))),
97 (fn () => (EVar
"no_ssl", dl
))),
99 (TBase
"your_user", dl
),
100 (fn () => (EString (Domain
.getUser ()), dl
))),
102 (TBase
"your_group", dl
),
103 (fn () => (EString
"nogroup", dl
))),
105 (TBase
"your_path", dl
),
106 (fn () => (EString (Domain
.homedir () ^
"/" ^ Config
.Apache
.public_html
), dl
))),
109 (fn () => (EString (Domain
.getUser () ^
"@" ^ Config
.defaultDomain
), dl
))),
111 (TBase
"suexec_flag", dl
),
112 (fn () => (EVar
"true", dl
)))]
114 val () = app Defaults
.registerDefault defaults
116 val redirect_code
= fn (EVar
"temp", _
) => SOME
"temp"
117 |
(EVar
"permanent", _
) => SOME
"permanent"
118 |
(EVar
"seeother", _
) => SOME
"seeother"
119 |
(EVar
"redir300", _
) => SOME
"300"
120 |
(EVar
"redir301", _
) => SOME
"301"
121 |
(EVar
"redir302", _
) => SOME
"302"
122 |
(EVar
"redir303", _
) => SOME
"303"
123 |
(EVar
"redir304", _
) => SOME
"304"
124 |
(EVar
"redir305", _
) => SOME
"305"
125 |
(EVar
"redir307", _
) => SOME
"307"
128 val flag
= fn (EVar
"redirect", _
) => SOME
"R"
129 |
(EVar
"forbidden", _
) => SOME
"F"
130 |
(EVar
"gone", _
) => SOME
"G"
131 |
(EVar
"last", _
) => SOME
"L"
132 |
(EVar
"chain", _
) => SOME
"C"
133 |
(EVar
"nosubreq", _
) => SOME
"NS"
134 |
(EVar
"nocase", _
) => SOME
"NC"
135 |
(EVar
"qsappend", _
) => SOME
"QSA"
136 |
(EVar
"noescape", _
) => SOME
"NE"
137 |
(EVar
"passthrough", _
) => SOME
"PT"
138 |
(EApp ((EVar
"mimeType", _
), e
), _
) =>
139 Option
.map (fn s
=> "T=" ^ s
) (Env
.string e
)
140 |
(EApp ((EVar
"redirectWith", _
), e
), _
) =>
141 Option
.map (fn s
=> "R=" ^ s
) (redirect_code e
)
142 |
(EApp ((EVar
"skip", _
), e
), _
) =>
143 Option
.map (fn n
=> "S=" ^
Int.toString n
) (Env
.int e
)
144 |
(EApp ((EApp ((EVar
"env", _
), e1
), _
), e2
), _
) =>
145 (case Env
.string e1
of
147 | SOME s1
=> Option
.map (fn s2
=> "E=" ^ s1 ^
":" ^ s2
)
152 val cond_flag
= fn (EVar
"cond_nocase", _
) => SOME
"NC"
153 |
(EVar
"ornext", _
) => SOME
"OR"
156 val apache_option
= fn (EVar
"execCGI", _
) => SOME
"ExecCGI"
157 |
(EVar
"includesNOEXEC", _
) => SOME
"IncludesNOEXEC"
158 |
(EVar
"indexes", _
) => SOME
"Indexes"
161 val autoindex_width
= fn (EVar
"autofit", _
) => SOME
"*"
162 |
(EApp ((EVar
"characters", _
), n
), _
) =>
163 Option
.map
Int.toString (Env
.int n
)
166 val autoindex_option
= fn (EApp ((EVar
"descriptionWidth", _
), w
), _
) =>
167 Option
.map (fn w
=> ("DescriptionWidth", SOME w
))
169 |
(EVar
"fancyIndexing", _
) => SOME ("FancyIndexing", NONE
)
170 |
(EVar
"foldersFirst", _
) => SOME ("FoldersFirst", NONE
)
171 |
(EVar
"htmlTable", _
) => SOME ("HTMLTable", NONE
)
172 |
(EVar
"iconsAreLinks", _
) => SOME ("IconsAreLinks", NONE
)
173 |
(EApp ((EVar
"iconHeight", _
), n
), _
) =>
174 Option
.map (fn w
=> ("IconHeight", SOME (Int.toString w
)))
176 |
(EApp ((EVar
"iconWidth", _
), n
), _
) =>
177 Option
.map (fn w
=> ("IconWidth", SOME (Int.toString w
)))
179 |
(EVar
"ignoreCase", _
) => SOME ("IgnoreCase", NONE
)
180 |
(EVar
"ignoreClient", _
) => SOME ("IgnoreClient", NONE
)
181 |
(EApp ((EVar
"nameWidth", _
), w
), _
) =>
182 Option
.map (fn w
=> ("NameWidth", SOME w
))
184 |
(EVar
"scanHtmlTitles", _
) => SOME ("ScanHTMLTitles", NONE
)
185 |
(EVar
"suppressColumnSorting", _
) => SOME ("SuppressColumnSorting", NONE
)
186 |
(EVar
"suppressDescription", _
) => SOME ("SuppressDescription", NONE
)
187 |
(EVar
"suppressHtmlPreamble", _
) => SOME ("SuppressHTMLPreamble", NONE
)
188 |
(EVar
"suppressIcon", _
) => SOME ("SuppressIcon", NONE
)
189 |
(EVar
"suppressLastModified", _
) => SOME ("SuppressLastModified", NONE
)
190 |
(EVar
"suppressRules", _
) => SOME ("SuppressRules", NONE
)
191 |
(EVar
"suppressSize", _
) => SOME ("SuppressSize", NONE
)
192 |
(EVar
"trackModified", _
) => SOME ("TrackModified", NONE
)
193 |
(EVar
"versionSort", _
) => SOME ("VersionSort", NONE
)
194 |
(EVar
"xhtml", _
) => SOME ("XHTML", NONE
)
198 val vhostsChanged
= ref
false
199 val logDeleted
= ref
false
201 val () = Slave
.registerPreHandler
202 (fn () => (vhostsChanged
:= false;
203 logDeleted
:= false))
205 fun findVhostUser fname
=
207 val inf
= TextIO.openIn fname
210 case TextIO.inputLine inf
of
213 if String.isPrefix
"# Owner: " line
then
214 case String.tokens
Char.isSpace line
of
215 [_
, _
, user
] => SOME user
221 before TextIO.closeIn inf
224 val webNodes_full
= Config
.Apache
.webNodes_all @ Config
.Apache
.webNodes_admin
226 fun isVersion1 node
=
227 List.exists (fn (n
, {version
= ConfigTypes
.APACHE_1_3
, ...}) => n
= node
228 | _
=> false) webNodes_full
230 fun imVersion1 () = isVersion1 (Slave
.hostname ())
233 List.exists (fn (n
, {auth
= ConfigTypes
.MOD_WAKLOG
, ...}) => n
= node
234 | _
=> false) webNodes_full
236 fun down () = if imVersion1 () then Config
.Apache
.down1
else Config
.Apache
.down
237 fun undown () = if imVersion1 () then Config
.Apache
.undown1
else Config
.Apache
.undown
238 fun reload () = if imVersion1 () then Config
.Apache
.reload1
else Config
.Apache
.reload
240 fun logDir
{user
, node
, vhostId
} =
241 String.concat
[Config
.Apache
.logDirOf (isVersion1 node
) user
,
247 val () = Slave
.registerFileHandler (fn fs
=>
249 val spl
= OS
.Path
.splitDirFile (#file fs
)
251 if String.isSuffix
".vhost" (#file spl
)
252 orelse String.isSuffix
".vhost_ssl" (#file spl
) then let
253 val realVhostFile
= OS
.Path
.joinDirFile
254 {dir
= Config
.Apache
.confDir
,
257 val user
= findVhostUser (#file fs
)
258 val oldUser
= findVhostUser realVhostFile
260 if (oldUser
= NONE
andalso #action fs
<> Slave
.Add
)
261 orelse (user
= NONE
andalso #action fs
<> Slave
.Delete
) then
262 print ("Can't find user in " ^ #file fs ^
" or " ^ realVhostFile ^
"! Taking no action.\n")
265 val vhostId
= if OS
.Path
.ext (#file spl
) = SOME
"vhost_ssl" then
266 OS
.Path
.base (#file spl
) ^
".ssl"
268 OS
.Path
.base (#file spl
)
270 fun realLogDir user
=
271 logDir
{user
= valOf user
,
272 node
= Slave
.hostname (),
275 vhostsChanged
:= true;
279 val ldir
= realLogDir oldUser
284 (ignore (OS
.Process
.system (down ()));
286 ignore (OS
.Process
.system (Config
.rm
289 Slave
.moveDirCreate
{from
= ldir
,
290 to
= Config
.Apache
.backupLogDirOf
291 (isVersion1 (Slave
.hostname ()))}
295 val rld
= realLogDir user
297 ignore (OS
.Process
.system (Config
.cp
302 if Posix
.FileSys
.access (rld
, []) then
305 Slave
.moveDirCreate
{from
= Config
.Apache
.backupLogDirOf
306 (isVersion1 (Slave
.hostname ())),
311 (ignore (OS
.Process
.system (Config
.cp
316 if user
<> oldUser
then
318 val old
= realLogDir oldUser
319 val rld
= realLogDir user
324 (ignore (OS
.Process
.system (down ()));
326 ignore (OS
.Process
.system (Config
.rm
328 ^ realLogDir oldUser
));
329 if Posix
.FileSys
.access (rld
, []) then
342 val () = Slave
.registerPostHandler
344 (if !vhostsChanged
then
345 Slave
.shellF ([if !logDeleted
then undown () else reload ()],
346 fn cl
=> "Error reloading Apache with " ^ cl
)
350 val vhostFiles
: (string * TextIO.outstream
) list ref
= ref
[]
351 fun write
' s
= app (fn (node
, file
) => TextIO.output (file
, s node
)) (!vhostFiles
)
352 fun write s
= app (fn (_
, file
) => TextIO.output (file
, s
)) (!vhostFiles
)
354 val rewriteEnabled
= ref
false
355 val localRewriteEnabled
= ref
false
356 val currentVhost
= ref
""
357 val currentVhostId
= ref
""
358 val sslEnabled
= ref
false
360 val pre
= ref (fn _
: {user
: string, nodes
: string list
, id
: string, hostname
: string} => ())
365 pre
:= (fn x
=> (old x
; f x
))
368 val post
= ref (fn () => ())
373 post
:= (fn () => (old (); f ()))
376 val aliaser
= ref (fn _
: string => ())
377 fun registerAliaser f
=
381 aliaser
:= (fn x
=> (old x
; f x
))
384 val () = Env
.containerV_one
"vhost"
388 val nodes
= Env
.env (Env
.list Env
.string) (env
, "WebNodes")
390 val ssl
= Env
.env
ssl (env
, "SSL")
391 val user
= Env
.env Env
.string (env
, "User")
392 val group
= Env
.env Env
.string (env
, "Group")
393 val docroot
= Env
.env Env
.string (env
, "DocumentRoot")
394 val sadmin
= Env
.env Env
.string (env
, "ServerAdmin")
395 val suexec
= Env
.env Env
.bool (env
, "SuExec")
397 val fullHost
= host ^
"." ^ Domain
.currentDomain ()
398 val vhostId
= fullHost ^
(if Option
.isSome ssl
then ".ssl" else "")
399 val confFile
= fullHost ^
(if Option
.isSome ssl
then ".vhost_ssl" else ".vhost")
401 currentVhost
:= fullHost
;
402 currentVhostId
:= vhostId
;
403 sslEnabled
:= Option
.isSome ssl
;
405 rewriteEnabled
:= false;
406 localRewriteEnabled
:= false;
407 vhostFiles
:= map (fn node
=>
409 val file
= Domain
.domainFile
{node
= node
,
412 val ld
= logDir
{user
= user
, node
= node
, vhostId
= vhostId
}
414 TextIO.output (file
, "# Owner: ");
415 TextIO.output (file
, user
);
416 TextIO.output (file
, "\n<VirtualHost ");
417 TextIO.output (file
, Domain
.nodeIp node
);
418 TextIO.output (file
, ":");
419 TextIO.output (file
, case ssl
of
422 TextIO.output (file
, ">\n");
423 TextIO.output (file
, "\tErrorLog ");
424 TextIO.output (file
, ld
);
425 TextIO.output (file
, "/error.log\n\tCustomLog ");
426 TextIO.output (file
, ld
);
427 TextIO.output (file
, "/access.log combined\n");
428 TextIO.output (file
, "\tServerName ");
429 TextIO.output (file
, fullHost
);
431 (fn dom
=> (TextIO.output (file
, "\n\tServerAlias ");
432 TextIO.output (file
, host
);
433 TextIO.output (file
, ".");
434 TextIO.output (file
, dom
)))
435 (Domain
.currentAliasDomains ());
438 if isVersion1 node
then
439 (TextIO.output (file
, "\n\tUser ");
440 TextIO.output (file
, user
);
441 TextIO.output (file
, "\n\tGroup ");
442 TextIO.output (file
, group
))
444 (TextIO.output (file
, "\n\tSuexecUserGroup ");
445 TextIO.output (file
, user
);
446 TextIO.output (file
, " ");
447 TextIO.output (file
, group
))
451 if isWaklog node
then
452 (TextIO.output (file
, "\n\tWaklogEnabled on\n\tWaklogLocationPrincipal ");
453 TextIO.output (file
, user
);
454 TextIO.output (file
, "/daemon@HCOOP.NET /etc/keytabs/user.daemon/");
455 TextIO.output (file
, user
))
459 TextIO.output (file
, "\n\tDAVLockDB /var/lock/apache2/dav/");
460 TextIO.output (file
, user
);
461 TextIO.output (file
, "/DAVLock");
466 write
"\n\tDocumentRoot ";
468 write
"\n\tServerAdmin ";
472 (write
"\n\tSSLEngine on\n\tSSLCertificateFile ";
476 !pre
{user
= user
, nodes
= nodes
, id
= vhostId
, hostname
= fullHost
};
477 app (fn dom
=> !aliaser (host ^
"." ^ dom
)) (Domain
.currentAliasDomains ())
480 write
"</VirtualHost>\n";
481 app (TextIO.closeOut
o #
2) (!vhostFiles
)))
483 val inLocal
= ref
false
485 val () = Env
.container_one
"location"
486 ("prefix", Env
.string)
488 (write
"\t<Location ";
492 fn () => (write
"\t</Location>\n";
494 localRewriteEnabled
:= false))
496 val () = Env
.container_one
"directory"
497 ("directory", Env
.string)
499 (write
"\t<Directory ";
503 fn () => (write
"\t</Directory>\n";
505 localRewriteEnabled
:= false))
507 fun checkRewrite () =
509 if !rewriteEnabled
orelse !localRewriteEnabled
then
512 (write
"\tRewriteEngine on\n";
513 localRewriteEnabled
:= true)
514 else if !rewriteEnabled
then
517 (write
"\tRewriteEngine on\n";
518 rewriteEnabled
:= true)
520 val () = Env
.action_three
"localProxyRewrite"
521 ("from", Env
.string, "to", Env
.string, "port", Env
.int)
522 (fn (from
, to
, port
) =>
524 write
"\tRewriteRule\t";
526 write
"\thttp://localhost:";
527 write (Int.toString port
);
532 val () = Env
.action_two
"proxyPass"
533 ("from", Env
.string, "to", Env
.string)
535 (write
"\tProxyPass\t";
541 val () = Env
.action_two
"proxyPassReverse"
542 ("from", Env
.string, "to", Env
.string)
544 (write
"\tProxyPassReverse\t";
550 val () = Env
.action_three
"rewriteRule"
551 ("from", Env
.string, "to", Env
.string, "flags", Env
.list flag
)
552 (fn (from
, to
, flags
) =>
554 write
"\tRewriteRule\t";
560 | flag
::rest
=> (write
" [";
562 app (fn flag
=> (write
",";
567 val () = Env
.action_three
"rewriteCond"
568 ("test", Env
.string, "pattern", Env
.string, "flags", Env
.list cond_flag
)
569 (fn (from
, to
, flags
) =>
571 write
"\tRewriteCond\t";
577 | flag
::rest
=> (write
" [";
579 app (fn flag
=> (write
",";
584 val () = Env
.action_one
"rewriteBase"
585 ("prefix", Env
.string)
588 write
"\tRewriteBase\t";
592 val () = Env
.action_one
"rewriteLogLevel"
596 write
"\tRewriteLog ";
598 write
"/rewrite.log\n\tRewriteLogLevel ";
599 write (Int.toString level
);
602 val () = Env
.action_two
"alias"
603 ("from", Env
.string, "to", Env
.string)
611 val () = Env
.action_two
"scriptAlias"
612 ("from", Env
.string, "to", Env
.string)
614 (write
"\tScriptAlias\t";
620 val () = Env
.action_two
"errorDocument"
621 ("code", Env
.string, "handler", Env
.string)
622 (fn (code
, handler
) =>
623 (write
"\tErrorDocument\t";
629 val () = Env
.action_one
"options"
630 ("options", Env
.list apache_option
)
634 | _
=> (write
"\tOptions";
635 app (fn opt
=> (write
" "; write opt
)) opts
;
638 val () = Env
.action_one
"set_options"
639 ("options", Env
.list apache_option
)
643 | _
=> (write
"\tOptions";
644 app (fn opt
=> (write
" +"; write opt
)) opts
;
647 val () = Env
.action_one
"unset_options"
648 ("options", Env
.list apache_option
)
652 | _
=> (write
"\tOptions";
653 app (fn opt
=> (write
" -"; write opt
)) opts
;
656 val () = Env
.action_one
"directoryIndex"
657 ("filenames", Env
.list Env
.string)
659 (write
"\tDirectoryIndex";
660 app (fn opt
=> (write
" "; write opt
)) opts
;
663 val () = Env
.action_one
"serverAliasHost"
666 (write
"\tServerAlias ";
671 val () = Env
.action_one
"serverAlias"
677 val full
= host ^
"." ^ dom
679 write
"\tServerAlias ";
684 (Domain
.currentDomains ())))
686 val () = Env
.action_none
"serverAliasDefault"
690 (write
"\tServerAlias ";
694 (Domain
.currentDomains ())))
696 val authType
= fn (EVar
"basic", _
) => SOME
"basic"
697 |
(EVar
"digest", _
) => SOME
"digest"
698 |
(EVar
"kerberos", _
) => SOME
"kerberos"
701 fun allowAuthType
"kerberos" = !sslEnabled
702 | allowAuthType _
= true
704 val () = Env
.action_one
"authType"
707 if allowAuthType ty
then
708 (write
"\tAuthType ";
713 write
"\tKrbMethodNegotiate off\n\tKrbMethodK5Passwd on\n\tKrbVerifyKDC off\n\tKrbAuthRealms HCOOP.NET\n\tKrbSaveCredentials on\n"
716 print
"WARNING: Skipped Kerberos authType because this isn't an SSL vhost.\n")
718 val () = Env
.action_one
"authName"
721 (write
"\tAuthName \"";
725 val () = Env
.action_one
"authUserFile"
728 (write
"\tAuthUserFile ";
732 val () = Env
.action_none
"requireValidUser"
733 (fn () => write
"\tRequire valid-user\n")
735 val () = Env
.action_one
"requireUser"
736 ("users", Env
.list Env
.string)
740 | _
=> (write
"\tRequire user";
741 app (fn name
=> (write
" "; write name
)) names
;
744 val () = Env
.action_one
"requireGroup"
745 ("groups", Env
.list Env
.string)
749 | _
=> (write
"\tRequire group";
750 app (fn name
=> (write
" "; write name
)) names
;
753 val () = Env
.action_none
"orderAllowDeny"
754 (fn () => write
"\tOrder allow,deny\n")
756 val () = Env
.action_none
"orderDenyAllow"
757 (fn () => write
"\tOrder deny,allow\n")
759 val () = Env
.action_none
"allowFromAll"
760 (fn () => write
"\tAllow from all\n")
762 val () = Env
.action_one
"allowFrom"
763 ("entries", Env
.list Env
.string)
767 | _
=> (write
"\tAllow from";
768 app (fn name
=> (write
" "; write name
)) names
;
771 val () = Env
.action_none
"denyFromAll"
772 (fn () => write
"\tDeny from all\n")
774 val () = Env
.action_one
"denyFrom"
775 ("entries", Env
.list Env
.string)
779 | _
=> (write
"\tDeny from";
780 app (fn name
=> (write
" "; write name
)) names
;
783 val () = Env
.action_none
"satisfyAll"
784 (fn () => write
"\tSatisfy all\n")
786 val () = Env
.action_none
"satisfyAny"
787 (fn () => write
"\tSatisfy any\n")
789 val () = Env
.action_one
"forceType"
791 (fn ty
=> (write
"\tForceType ";
795 val () = Env
.action_none
"forceTypeOff"
796 (fn () => write
"\tForceType None\n")
798 val () = Env
.action_two
"action"
799 ("what", Env
.string, "how", Env
.string)
800 (fn (what
, how
) => (write
"\tAction ";
806 val () = Env
.action_one
"addDefaultCharset"
807 ("charset", Env
.string)
808 (fn ty
=> (write
"\tAddDefaultCharset ";
812 (*val () = Env
.action_one
"davSvn"
814 (fn path
=> (write
"\tDAV svn\n\tSVNPath ";
818 val () = Env
.action_one
"authzSvnAccessFile"
820 (fn path
=> (write
"\tAuthzSVNAccessFile ";
824 val () = Env
.action_none
"davFilesystem"
825 (fn path
=> write
"\tDAV filesystem\n")
827 val () = Env
.action_two
"addDescription"
828 ("description", Env
.string, "patterns", Env
.list Env
.string)
832 | _
=> (write
"\tAddDescription \"";
833 write (String.toString desc
);
835 app (fn pat
=> (write
" "; write pat
)) pats
;
838 val () = Env
.action_one
"indexOptions"
839 ("options", Env
.list autoindex_option
)
843 | _
=> (write
"\tIndexOptions";
844 app (fn (opt
, arg
) =>
847 Option
.app (fn arg
=>
848 (write
"="; write arg
)) arg
)) opts
;
851 val () = Env
.action_one
"set_indexOptions"
852 ("options", Env
.list autoindex_option
)
856 | _
=> (write
"\tIndexOptions";
857 app (fn (opt
, arg
) =>
860 Option
.app (fn arg
=>
861 (write
"="; write arg
)) arg
)) opts
;
864 val () = Env
.action_one
"unset_indexOptions"
865 ("options", Env
.list autoindex_option
)
869 | _
=> (write
"\tIndexOptions";
875 val () = Env
.action_one
"headerName"
877 (fn name
=> (write
"\tHeaderName ";
881 val () = Env
.action_one
"readmeName"
883 (fn name
=> (write
"\tReadmeName ";
887 val () = Env
.action_two
"setEnv"
888 ("key", Env
.string, "value", Env
.string)
889 (fn (key
, value
) => (write
"\tSetEnv \"";
892 write (String.translate (fn #
"\"" => "\\\""
893 | ch
=> str ch
) value
);
896 val () = Domain
.registerResetLocal (fn () =>
897 ignore (OS
.Process
.system (Config
.rm ^
" -rf /var/domtool/vhosts/*")))
899 val () = Domain
.registerDescriber (Domain
.considerAll
900 [Domain
.Extension
{extension
= "vhost",
901 heading
= fn host
=> "Web vhost " ^ host
},
902 Domain
.Extension
{extension
= "vhost_ssl",
903 heading
= fn host
=> "SSL web vhost " ^ host
}])