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
26 List.exists (fn (x
, _
) => x
= node
) Config
.Apache
.webNodes_all
27 orelse (Domain
.hasPriv
"www"
28 andalso List.exists (fn (x
, _
) => x
= node
) Config
.Apache
.webNodes_admin
)
30 val _
= Env
.type_one
"web_node"
34 val _
= Env
.registerFunction ("web_node_to_node",
38 val _
= Env
.type_one
"proxy_port"
42 val _
= Env
.type_one
"proxy_target"
46 fun default () = List.exists (fn s
' => s
= s
') Config
.Apache
.proxyTargets
48 case String.fields (fn ch
=> ch
= #
":") s
of
49 ["http", "//localhost", rest
] =>
50 (case String.fields (fn ch
=> ch
= #
"/") rest
of
52 (case Int.fromString port
of
54 | SOME n
=> n
> 1024 orelse default ())
59 val _
= Env
.type_one
"rewrite_arg"
61 (CharVector
.all
Char.isAlphaNum
)
63 val _
= Env
.type_one
"suexec_flag"
65 (fn b
=> b
orelse Domain
.hasPriv
"www")
68 size s
> 0 andalso size s
< 1000 andalso CharVector
.all
69 (fn ch
=> Char.isAlphaNum ch
75 val _
= Env
.type_one
"location"
79 fun validCert s
= Acl
.query
{user
= Domain
.getUser (),
83 val _
= Env
.type_one
"ssl_cert_path"
88 (EVar
"no_ssl", _
) => SOME NONE
89 |
(EApp ((EVar
"use_cert", _
), s
), _
) => Option
.map
SOME (Env
.string s
)
92 val dl
= ErrorMsg
.dummyLoc
94 val defaults
= [("WebNodes",
95 (TList (TBase
"web_node", dl
), dl
),
96 (fn () => (EList (map (fn s
=> (EString s
, dl
)) Config
.Apache
.webNodes_default
), dl
))),
99 (fn () => (EVar
"no_ssl", dl
))),
101 (TBase
"your_user", dl
),
102 (fn () => (EString (Domain
.getUser ()), dl
))),
104 (TBase
"your_group", dl
),
105 (fn () => (EString
"nogroup", dl
))),
107 (TBase
"your_path", dl
),
108 (fn () => (EString (Domain
.homedir () ^
"/" ^ Config
.Apache
.public_html
), dl
))),
111 (fn () => (EString (Domain
.getUser () ^
"@" ^ Config
.defaultDomain
), dl
))),
113 (TBase
"suexec_flag", dl
),
114 (fn () => (EVar
"true", dl
)))]
116 val () = app Defaults
.registerDefault defaults
118 val redirect_code
= fn (EVar
"temp", _
) => SOME
"temp"
119 |
(EVar
"permanent", _
) => SOME
"permanent"
120 |
(EVar
"seeother", _
) => SOME
"seeother"
121 |
(EVar
"redir300", _
) => SOME
"300"
122 |
(EVar
"redir301", _
) => SOME
"301"
123 |
(EVar
"redir302", _
) => SOME
"302"
124 |
(EVar
"redir303", _
) => SOME
"303"
125 |
(EVar
"redir304", _
) => SOME
"304"
126 |
(EVar
"redir305", _
) => SOME
"305"
127 |
(EVar
"redir307", _
) => SOME
"307"
130 val flag
= fn (EVar
"redirect", _
) => SOME
"R"
131 |
(EVar
"forbidden", _
) => SOME
"F"
132 |
(EVar
"gone", _
) => SOME
"G"
133 |
(EVar
"last", _
) => SOME
"L"
134 |
(EVar
"chain", _
) => SOME
"C"
135 |
(EVar
"nosubreq", _
) => SOME
"NS"
136 |
(EVar
"nocase", _
) => SOME
"NC"
137 |
(EVar
"qsappend", _
) => SOME
"QSA"
138 |
(EVar
"noescape", _
) => SOME
"NE"
139 |
(EVar
"passthrough", _
) => SOME
"PT"
140 |
(EApp ((EVar
"mimeType", _
), e
), _
) =>
141 Option
.map (fn s
=> "T=" ^ s
) (Env
.string e
)
142 |
(EApp ((EVar
"redirectWith", _
), e
), _
) =>
143 Option
.map (fn s
=> "R=" ^ s
) (redirect_code e
)
144 |
(EApp ((EVar
"skip", _
), e
), _
) =>
145 Option
.map (fn n
=> "S=" ^
Int.toString n
) (Env
.int e
)
146 |
(EApp ((EApp ((EVar
"env", _
), e1
), _
), e2
), _
) =>
147 (case Env
.string e1
of
149 | SOME s1
=> Option
.map (fn s2
=> "E=" ^ s1 ^
":" ^ s2
)
154 val cond_flag
= fn (EVar
"cond_nocase", _
) => SOME
"NC"
155 |
(EVar
"ornext", _
) => SOME
"OR"
158 val apache_option
= fn (EVar
"execCGI", _
) => SOME
"ExecCGI"
159 |
(EVar
"includesNOEXEC", _
) => SOME
"IncludesNOEXEC"
160 |
(EVar
"indexes", _
) => SOME
"Indexes"
163 val autoindex_width
= fn (EVar
"autofit", _
) => SOME
"*"
164 |
(EApp ((EVar
"characters", _
), n
), _
) =>
165 Option
.map
Int.toString (Env
.int n
)
168 val autoindex_option
= fn (EApp ((EVar
"descriptionWidth", _
), w
), _
) =>
169 Option
.map (fn w
=> ("DescriptionWidth", SOME w
))
171 |
(EVar
"fancyIndexing", _
) => SOME ("FancyIndexing", NONE
)
172 |
(EVar
"foldersFirst", _
) => SOME ("FoldersFirst", NONE
)
173 |
(EVar
"htmlTable", _
) => SOME ("HTMLTable", NONE
)
174 |
(EVar
"iconsAreLinks", _
) => SOME ("IconsAreLinks", NONE
)
175 |
(EApp ((EVar
"iconHeight", _
), n
), _
) =>
176 Option
.map (fn w
=> ("IconHeight", SOME (Int.toString w
)))
178 |
(EApp ((EVar
"iconWidth", _
), n
), _
) =>
179 Option
.map (fn w
=> ("IconWidth", SOME (Int.toString w
)))
181 |
(EVar
"ignoreCase", _
) => SOME ("IgnoreCase", NONE
)
182 |
(EVar
"ignoreClient", _
) => SOME ("IgnoreClient", NONE
)
183 |
(EApp ((EVar
"nameWidth", _
), w
), _
) =>
184 Option
.map (fn w
=> ("NameWidth", SOME w
))
186 |
(EVar
"scanHtmlTitles", _
) => SOME ("ScanHTMLTitles", NONE
)
187 |
(EVar
"suppressColumnSorting", _
) => SOME ("SuppressColumnSorting", NONE
)
188 |
(EVar
"suppressDescription", _
) => SOME ("SuppressDescription", NONE
)
189 |
(EVar
"suppressHtmlPreamble", _
) => SOME ("SuppressHTMLPreamble", NONE
)
190 |
(EVar
"suppressIcon", _
) => SOME ("SuppressIcon", NONE
)
191 |
(EVar
"suppressLastModified", _
) => SOME ("SuppressLastModified", NONE
)
192 |
(EVar
"suppressRules", _
) => SOME ("SuppressRules", NONE
)
193 |
(EVar
"suppressSize", _
) => SOME ("SuppressSize", NONE
)
194 |
(EVar
"trackModified", _
) => SOME ("TrackModified", NONE
)
195 |
(EVar
"versionSort", _
) => SOME ("VersionSort", NONE
)
196 |
(EVar
"xhtml", _
) => SOME ("XHTML", NONE
)
200 val vhostsChanged
= ref
false
201 val logDeleted
= ref
false
203 val () = Slave
.registerPreHandler
204 (fn () => (vhostsChanged
:= false;
205 logDeleted
:= false))
207 fun findVhostUser fname
=
209 val inf
= TextIO.openIn fname
212 case TextIO.inputLine inf
of
215 if String.isPrefix
"# Owner: " line
then
216 case String.tokens
Char.isSpace line
of
217 [_
, _
, user
] => SOME user
223 before TextIO.closeIn inf
226 val webNodes_full
= Config
.Apache
.webNodes_all @ Config
.Apache
.webNodes_admin
228 fun isVersion1 node
=
229 List.exists (fn (n
, {version
= ConfigTypes
.APACHE_1_3
, ...}) => n
= node
230 | _
=> false) webNodes_full
232 fun imVersion1 () = isVersion1 (Slave
.hostname ())
235 List.exists (fn (n
, {auth
= ConfigTypes
.MOD_WAKLOG
, ...}) => n
= node
236 | _
=> false) webNodes_full
238 fun down () = if imVersion1 () then Config
.Apache
.down1
else Config
.Apache
.down
239 fun undown () = if imVersion1 () then Config
.Apache
.undown1
else Config
.Apache
.undown
240 fun reload () = if imVersion1 () then Config
.Apache
.reload1
else Config
.Apache
.reload
241 fun fixperms () = if imVersion1 () then Config
.Apache
.fixperms1
else Config
.Apache
.fixperms
243 fun logDir
{user
, node
, vhostId
} =
244 String.concat
[Config
.Apache
.logDirOf (isVersion1 node
) user
,
250 val () = Slave
.registerFileHandler (fn fs
=>
252 val spl
= OS
.Path
.splitDirFile (#file fs
)
254 if String.isSuffix
".vhost" (#file spl
)
255 orelse String.isSuffix
".vhost_ssl" (#file spl
) then let
256 val realVhostFile
= OS
.Path
.joinDirFile
257 {dir
= Config
.Apache
.confDir
,
260 val user
= findVhostUser (#file fs
)
261 val oldUser
= case #action fs
of
262 Slave
.Delete
false => user
263 | _
=> findVhostUser realVhostFile
265 if (oldUser
= NONE
andalso #action fs
<> Slave
.Add
)
266 orelse (user
= NONE
andalso not (Slave
.isDelete (#action fs
))) then
267 print ("Can't find user in " ^ #file fs ^
" or " ^ realVhostFile ^
"! Taking no action.\n")
270 val vhostId
= if OS
.Path
.ext (#file spl
) = SOME
"vhost_ssl" then
271 OS
.Path
.base (#file spl
) ^
".ssl"
273 OS
.Path
.base (#file spl
)
275 fun realLogDir user
=
276 logDir
{user
= valOf user
,
277 node
= Slave
.hostname (),
282 {dir
= Config
.Apache
.backupLogDirOf
283 (isVersion1 (Slave
.hostname ())),
286 vhostsChanged
:= true;
290 val ldir
= realLogDir oldUser
295 (ignore (OS
.Process
.system (down ()));
296 ignore (OS
.Process
.system (fixperms ()));
298 ignore (OS
.Process
.system (Config
.rm
301 Slave
.moveDirCreate
{from
= ldir
,
306 val rld
= realLogDir user
308 ignore (OS
.Process
.system (Config
.cp
313 if Posix
.FileSys
.access (rld
, []) then
316 Slave
.moveDirCreate
{from
= backupLogs (),
321 (ignore (OS
.Process
.system (Config
.cp
326 if user
<> oldUser
then
328 val old
= realLogDir oldUser
329 val rld
= realLogDir user
334 (ignore (OS
.Process
.system (down ()));
336 ignore (OS
.Process
.system (Config
.rm
338 ^ realLogDir oldUser
));
339 if Posix
.FileSys
.access (rld
, []) then
352 val () = Slave
.registerPostHandler
354 (if !vhostsChanged
then
355 Slave
.shellF ([if !logDeleted
then undown () else reload ()],
356 fn cl
=> "Error reloading Apache with " ^ cl
)
360 val vhostFiles
: (string * TextIO.outstream
) list ref
= ref
[]
361 fun write
' s
= app (fn (node
, file
) => TextIO.output (file
, s node
)) (!vhostFiles
)
362 fun write s
= app (fn (_
, file
) => TextIO.output (file
, s
)) (!vhostFiles
)
364 val rewriteEnabled
= ref
false
365 val localRewriteEnabled
= ref
false
366 val currentVhost
= ref
""
367 val currentVhostId
= ref
""
368 val sslEnabled
= ref
false
370 val pre
= ref (fn _
: {user
: string, nodes
: string list
, id
: string, hostname
: string} => ())
375 pre
:= (fn x
=> (old x
; f x
))
378 val post
= ref (fn () => ())
383 post
:= (fn () => (old (); f ()))
386 val aliaser
= ref (fn _
: string => ())
387 fun registerAliaser f
=
391 aliaser
:= (fn x
=> (old x
; f x
))
394 val () = Env
.containerV_one
"vhost"
398 val nodes
= Env
.env (Env
.list Env
.string) (env
, "WebNodes")
400 val ssl
= Env
.env
ssl (env
, "SSL")
401 val user
= Env
.env Env
.string (env
, "User")
402 val group
= Env
.env Env
.string (env
, "Group")
403 val docroot
= Env
.env Env
.string (env
, "DocumentRoot")
404 val sadmin
= Env
.env Env
.string (env
, "ServerAdmin")
405 val suexec
= Env
.env Env
.bool (env
, "SuExec")
407 val fullHost
= host ^
"." ^ Domain
.currentDomain ()
408 val vhostId
= fullHost ^
(if Option
.isSome ssl
then ".ssl" else "")
409 val confFile
= fullHost ^
(if Option
.isSome ssl
then ".vhost_ssl" else ".vhost")
411 currentVhost
:= fullHost
;
412 currentVhostId
:= vhostId
;
413 sslEnabled
:= Option
.isSome ssl
;
415 rewriteEnabled
:= false;
416 localRewriteEnabled
:= false;
417 vhostFiles
:= map (fn node
=>
419 val file
= Domain
.domainFile
{node
= node
,
422 val ld
= logDir
{user
= user
, node
= node
, vhostId
= vhostId
}
424 TextIO.output (file
, "# Owner: ");
425 TextIO.output (file
, user
);
426 TextIO.output (file
, "\n<VirtualHost ");
427 TextIO.output (file
, Domain
.nodeIp node
);
428 TextIO.output (file
, ":");
429 TextIO.output (file
, case ssl
of
432 TextIO.output (file
, ">\n");
433 TextIO.output (file
, "\tErrorLog ");
434 TextIO.output (file
, ld
);
435 TextIO.output (file
, "/error.log\n\tCustomLog ");
436 TextIO.output (file
, ld
);
437 TextIO.output (file
, "/access.log combined\n");
438 TextIO.output (file
, "\tServerName ");
439 TextIO.output (file
, fullHost
);
441 (fn dom
=> (TextIO.output (file
, "\n\tServerAlias ");
442 TextIO.output (file
, host
);
443 TextIO.output (file
, ".");
444 TextIO.output (file
, dom
)))
445 (Domain
.currentAliasDomains ());
448 if isVersion1 node
then
449 (TextIO.output (file
, "\n\tUser ");
450 TextIO.output (file
, user
);
451 TextIO.output (file
, "\n\tGroup ");
452 TextIO.output (file
, group
))
454 (TextIO.output (file
, "\n\tSuexecUserGroup ");
455 TextIO.output (file
, user
);
456 TextIO.output (file
, " ");
457 TextIO.output (file
, group
))
461 if isWaklog node
then
462 (TextIO.output (file
, "\n\tWaklogEnabled on\n\tWaklogLocationPrincipal ");
463 TextIO.output (file
, user
);
464 TextIO.output (file
, "/daemon@HCOOP.NET /etc/keytabs/user.daemon/");
465 TextIO.output (file
, user
))
469 TextIO.output (file
, "\n\tDAVLockDB /var/lock/apache2/dav/");
470 TextIO.output (file
, user
);
471 TextIO.output (file
, "/DAVLock");
476 write
"\n\tDocumentRoot ";
478 write
"\n\tServerAdmin ";
482 (write
"\n\tSSLEngine on\n\tSSLCertificateFile ";
486 !pre
{user
= user
, nodes
= nodes
, id
= vhostId
, hostname
= fullHost
};
487 app (fn dom
=> !aliaser (host ^
"." ^ dom
)) (Domain
.currentAliasDomains ())
490 write
"</VirtualHost>\n";
491 app (TextIO.closeOut
o #
2) (!vhostFiles
)))
493 val inLocal
= ref
false
495 val () = Env
.container_one
"location"
496 ("prefix", Env
.string)
498 (write
"\t<Location ";
502 fn () => (write
"\t</Location>\n";
504 localRewriteEnabled
:= false))
506 val () = Env
.container_one
"directory"
507 ("directory", Env
.string)
509 (write
"\t<Directory ";
513 fn () => (write
"\t</Directory>\n";
515 localRewriteEnabled
:= false))
517 fun checkRewrite () =
519 if !rewriteEnabled
orelse !localRewriteEnabled
then
522 (write
"\tRewriteEngine on\n";
523 localRewriteEnabled
:= true)
524 else if !rewriteEnabled
then
527 (write
"\tRewriteEngine on\n";
528 rewriteEnabled
:= true)
530 val () = Env
.action_three
"localProxyRewrite"
531 ("from", Env
.string, "to", Env
.string, "port", Env
.int)
532 (fn (from
, to
, port
) =>
534 write
"\tRewriteRule\t";
536 write
"\thttp://localhost:";
537 write (Int.toString port
);
542 val () = Env
.action_two
"proxyPass"
543 ("from", Env
.string, "to", Env
.string)
545 (write
"\tProxyPass\t";
551 val () = Env
.action_two
"proxyPassReverse"
552 ("from", Env
.string, "to", Env
.string)
554 (write
"\tProxyPassReverse\t";
560 val () = Env
.action_three
"rewriteRule"
561 ("from", Env
.string, "to", Env
.string, "flags", Env
.list flag
)
562 (fn (from
, to
, flags
) =>
564 write
"\tRewriteRule\t";
570 | flag
::rest
=> (write
" [";
572 app (fn flag
=> (write
",";
577 val () = Env
.action_three
"rewriteCond"
578 ("test", Env
.string, "pattern", Env
.string, "flags", Env
.list cond_flag
)
579 (fn (from
, to
, flags
) =>
581 write
"\tRewriteCond\t";
587 | flag
::rest
=> (write
" [";
589 app (fn flag
=> (write
",";
594 val () = Env
.action_one
"rewriteBase"
595 ("prefix", Env
.string)
598 write
"\tRewriteBase\t";
602 val () = Env
.action_one
"rewriteLogLevel"
606 write
"\tRewriteLog ";
608 write
"/rewrite.log\n\tRewriteLogLevel ";
609 write (Int.toString level
);
612 val () = Env
.action_two
"alias"
613 ("from", Env
.string, "to", Env
.string)
621 val () = Env
.action_two
"scriptAlias"
622 ("from", Env
.string, "to", Env
.string)
624 (write
"\tScriptAlias\t";
630 val () = Env
.action_two
"errorDocument"
631 ("code", Env
.string, "handler", Env
.string)
632 (fn (code
, handler
) =>
633 (write
"\tErrorDocument\t";
639 val () = Env
.action_one
"options"
640 ("options", Env
.list apache_option
)
644 | _
=> (write
"\tOptions";
645 app (fn opt
=> (write
" "; write opt
)) opts
;
648 val () = Env
.action_one
"set_options"
649 ("options", Env
.list apache_option
)
653 | _
=> (write
"\tOptions";
654 app (fn opt
=> (write
" +"; write opt
)) opts
;
657 val () = Env
.action_one
"unset_options"
658 ("options", Env
.list apache_option
)
662 | _
=> (write
"\tOptions";
663 app (fn opt
=> (write
" -"; write opt
)) opts
;
666 val () = Env
.action_one
"directoryIndex"
667 ("filenames", Env
.list Env
.string)
669 (write
"\tDirectoryIndex";
670 app (fn opt
=> (write
" "; write opt
)) opts
;
673 val () = Env
.action_one
"serverAliasHost"
676 (write
"\tServerAlias ";
681 val () = Env
.action_one
"serverAlias"
687 val full
= host ^
"." ^ dom
689 write
"\tServerAlias ";
694 (Domain
.currentDomains ())))
696 val () = Env
.action_none
"serverAliasDefault"
700 (write
"\tServerAlias ";
704 (Domain
.currentDomains ())))
706 val authType
= fn (EVar
"basic", _
) => SOME
"basic"
707 |
(EVar
"digest", _
) => SOME
"digest"
708 |
(EVar
"kerberos", _
) => SOME
"kerberos"
711 fun allowAuthType
"kerberos" = !sslEnabled
712 | allowAuthType _
= true
714 val () = Env
.action_one
"authType"
717 if allowAuthType ty
then
718 (write
"\tAuthType ";
723 write
"\tKrbMethodNegotiate off\n\tKrbMethodK5Passwd on\n\tKrbVerifyKDC off\n\tKrbAuthRealms HCOOP.NET\n\tKrbSaveCredentials on\n"
726 print
"WARNING: Skipped Kerberos authType because this isn't an SSL vhost.\n")
728 val () = Env
.action_one
"authName"
731 (write
"\tAuthName \"";
735 val () = Env
.action_one
"authUserFile"
738 (write
"\tAuthUserFile ";
742 val () = Env
.action_none
"requireValidUser"
743 (fn () => write
"\tRequire valid-user\n")
745 val () = Env
.action_one
"requireUser"
746 ("users", Env
.list Env
.string)
750 | _
=> (write
"\tRequire user";
751 app (fn name
=> (write
" "; write name
)) names
;
754 val () = Env
.action_one
"requireGroup"
755 ("groups", Env
.list Env
.string)
759 | _
=> (write
"\tRequire group";
760 app (fn name
=> (write
" "; write name
)) names
;
763 val () = Env
.action_none
"orderAllowDeny"
764 (fn () => write
"\tOrder allow,deny\n")
766 val () = Env
.action_none
"orderDenyAllow"
767 (fn () => write
"\tOrder deny,allow\n")
769 val () = Env
.action_none
"allowFromAll"
770 (fn () => write
"\tAllow from all\n")
772 val () = Env
.action_one
"allowFrom"
773 ("entries", Env
.list Env
.string)
777 | _
=> (write
"\tAllow from";
778 app (fn name
=> (write
" "; write name
)) names
;
781 val () = Env
.action_none
"denyFromAll"
782 (fn () => write
"\tDeny from all\n")
784 val () = Env
.action_one
"denyFrom"
785 ("entries", Env
.list Env
.string)
789 | _
=> (write
"\tDeny from";
790 app (fn name
=> (write
" "; write name
)) names
;
793 val () = Env
.action_none
"satisfyAll"
794 (fn () => write
"\tSatisfy all\n")
796 val () = Env
.action_none
"satisfyAny"
797 (fn () => write
"\tSatisfy any\n")
799 val () = Env
.action_one
"forceType"
801 (fn ty
=> (write
"\tForceType ";
805 val () = Env
.action_none
"forceTypeOff"
806 (fn () => write
"\tForceType None\n")
808 val () = Env
.action_two
"action"
809 ("what", Env
.string, "how", Env
.string)
810 (fn (what
, how
) => (write
"\tAction ";
816 val () = Env
.action_one
"addDefaultCharset"
817 ("charset", Env
.string)
818 (fn ty
=> (write
"\tAddDefaultCharset ";
822 (*val () = Env
.action_one
"davSvn"
824 (fn path
=> (write
"\tDAV svn\n\tSVNPath ";
828 val () = Env
.action_one
"authzSvnAccessFile"
830 (fn path
=> (write
"\tAuthzSVNAccessFile ";
834 val () = Env
.action_none
"davFilesystem"
835 (fn path
=> write
"\tDAV filesystem\n")
837 val () = Env
.action_two
"addDescription"
838 ("description", Env
.string, "patterns", Env
.list Env
.string)
842 | _
=> (write
"\tAddDescription \"";
843 write (String.toString desc
);
845 app (fn pat
=> (write
" "; write pat
)) pats
;
848 val () = Env
.action_one
"indexOptions"
849 ("options", Env
.list autoindex_option
)
853 | _
=> (write
"\tIndexOptions";
854 app (fn (opt
, arg
) =>
857 Option
.app (fn arg
=>
858 (write
"="; write arg
)) arg
)) opts
;
861 val () = Env
.action_one
"set_indexOptions"
862 ("options", Env
.list autoindex_option
)
866 | _
=> (write
"\tIndexOptions";
867 app (fn (opt
, arg
) =>
870 Option
.app (fn arg
=>
871 (write
"="; write arg
)) arg
)) opts
;
874 val () = Env
.action_one
"unset_indexOptions"
875 ("options", Env
.list autoindex_option
)
879 | _
=> (write
"\tIndexOptions";
885 val () = Env
.action_one
"headerName"
887 (fn name
=> (write
"\tHeaderName ";
891 val () = Env
.action_one
"readmeName"
893 (fn name
=> (write
"\tReadmeName ";
897 val () = Env
.action_two
"setEnv"
898 ("key", Env
.string, "value", Env
.string)
899 (fn (key
, value
) => (write
"\tSetEnv \"";
902 write (String.translate (fn #
"\"" => "\\\""
903 | ch
=> str ch
) value
);
906 val () = Domain
.registerResetLocal (fn () =>
907 ignore (OS
.Process
.system (Config
.rm ^
" -rf /var/domtool/vhosts/*")))
909 val () = Domain
.registerDescriber (Domain
.considerAll
910 [Domain
.Extension
{extension
= "vhost",
911 heading
= fn host
=> "Web vhost " ^ host
},
912 Domain
.Extension
{extension
= "vhost_ssl",
913 heading
= fn host
=> "SSL web vhost " ^ host
}])