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 dl
= ErrorMsg
.dummyLoc
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
.type_one
"web_node"
36 val _
= Env
.registerFunction ("web_node_to_node",
40 fun webPlace (EApp ((EVar
"web_place_default", _
), (EString node
, _
)), _
) =
41 SOME (node
, Domain
.nodeIp node
)
42 |
webPlace (EApp ((EApp ((EVar
"web_place", _
), (EString node
, _
)), _
), (EString ip
, _
)), _
) =
46 fun webPlaceDefault node
= (EApp ((EVar
"web_place_default", dl
), (EString node
, dl
)), dl
)
48 val _
= Env
.registerFunction ("web_place_to_web_node",
49 fn [e
] => Option
.map (fn (node
, _
) => (EString node
, dl
)) (webPlace e
)
52 val _
= Env
.registerFunction ("web_place_to_node",
53 fn [e
] => Option
.map (fn (node
, _
) => (EString node
, dl
)) (webPlace e
)
56 val _
= Env
.registerFunction ("web_place_to_ip",
57 fn [e
] => Option
.map (fn (_
, ip
) => (EString ip
, dl
)) (webPlace e
)
60 val _
= Env
.type_one
"proxy_port"
64 val _
= Env
.type_one
"proxy_target"
68 fun default () = List.exists (fn s
' => s
= s
') Config
.Apache
.proxyTargets
70 case String.fields (fn ch
=> ch
= #
":") s
of
71 ["http", "//localhost", rest
] =>
72 (case String.fields (fn ch
=> ch
= #
"/") rest
of
74 (case Int.fromString port
of
76 | SOME n
=> n
> 1024 orelse default ())
81 val _
= Env
.type_one
"rewrite_arg"
83 (CharVector
.all
Char.isAlphaNum
)
85 val _
= Env
.type_one
"suexec_flag"
87 (fn b
=> b
orelse Domain
.hasPriv
"www")
89 val _
= Env
.type_one
"regexp"
94 size s
> 0 andalso size s
< 1000 andalso CharVector
.all
95 (fn ch
=> Char.isAlphaNum ch
101 val _
= Env
.type_one
"location"
105 fun validCert s
= Acl
.query
{user
= Domain
.getUser (),
109 val _
= Env
.type_one
"ssl_cert_path"
113 fun ssl e
= case e
of
114 (EVar
"no_ssl", _
) => SOME NONE
115 |
(EApp ((EVar
"use_cert", _
), s
), _
) => Option
.map
SOME (Env
.string s
)
118 fun validExtension s
=
121 andalso CharVector
.all (fn ch
=> Char.isAlphaNum ch
orelse ch
= #
"_") s
123 val _
= Env
.type_one
"file_extension"
127 val defaults
= [("WebPlaces",
128 (TList (TBase
"web_place", dl
), dl
),
129 (fn () => (EList (map webPlaceDefault Config
.Apache
.webNodes_default
), dl
))),
132 (fn () => (EVar
"no_ssl", dl
))),
134 (TBase
"your_user", dl
),
135 (fn () => (EString (Domain
.getUser ()), dl
))),
137 (TBase
"your_group", dl
),
138 (fn () => (EString
"nogroup", dl
))),
140 (TBase
"your_path", dl
),
141 (fn () => (EString (Domain
.homedir () ^
"/" ^ Config
.Apache
.public_html
), dl
))),
144 (fn () => (EString (Domain
.getUser () ^
"@" ^ Config
.defaultDomain
), dl
))),
146 (TBase
"suexec_flag", dl
),
147 (fn () => (EVar
"true", dl
)))]
149 val () = app Defaults
.registerDefault defaults
151 val redirect_code
= fn (EVar
"temp", _
) => SOME
"temp"
152 |
(EVar
"permanent", _
) => SOME
"permanent"
153 |
(EVar
"seeother", _
) => SOME
"seeother"
154 |
(EVar
"redir300", _
) => SOME
"300"
155 |
(EVar
"redir301", _
) => SOME
"301"
156 |
(EVar
"redir302", _
) => SOME
"302"
157 |
(EVar
"redir303", _
) => SOME
"303"
158 |
(EVar
"redir304", _
) => SOME
"304"
159 |
(EVar
"redir305", _
) => SOME
"305"
160 |
(EVar
"redir307", _
) => SOME
"307"
163 val flag
= fn (EVar
"redirect", _
) => SOME
"R"
164 |
(EVar
"forbidden", _
) => SOME
"F"
165 |
(EVar
"gone", _
) => SOME
"G"
166 |
(EVar
"last", _
) => SOME
"L"
167 |
(EVar
"chain", _
) => SOME
"C"
168 |
(EVar
"nosubreq", _
) => SOME
"NS"
169 |
(EVar
"nocase", _
) => SOME
"NC"
170 |
(EVar
"qsappend", _
) => SOME
"QSA"
171 |
(EVar
"noescape", _
) => SOME
"NE"
172 |
(EVar
"passthrough", _
) => SOME
"PT"
173 |
(EApp ((EVar
"mimeType", _
), e
), _
) =>
174 Option
.map (fn s
=> "T=" ^ s
) (Env
.string e
)
175 |
(EApp ((EVar
"redirectWith", _
), e
), _
) =>
176 Option
.map (fn s
=> "R=" ^ s
) (redirect_code e
)
177 |
(EApp ((EVar
"skip", _
), e
), _
) =>
178 Option
.map (fn n
=> "S=" ^
Int.toString n
) (Env
.int e
)
179 |
(EApp ((EApp ((EVar
"env", _
), e1
), _
), e2
), _
) =>
180 (case Env
.string e1
of
182 | SOME s1
=> Option
.map (fn s2
=> "E=" ^ s1 ^
":" ^ s2
)
187 val cond_flag
= fn (EVar
"cond_nocase", _
) => SOME
"NC"
188 |
(EVar
"ornext", _
) => SOME
"OR"
191 val apache_option
= fn (EVar
"execCGI", _
) => SOME
"ExecCGI"
192 |
(EVar
"includesNOEXEC", _
) => SOME
"IncludesNOEXEC"
193 |
(EVar
"indexes", _
) => SOME
"Indexes"
194 |
(EVar
"followSymLinks", _
) => SOME
"FollowSymLinks"
197 val autoindex_width
= fn (EVar
"autofit", _
) => SOME
"*"
198 |
(EApp ((EVar
"characters", _
), n
), _
) =>
199 Option
.map
Int.toString (Env
.int n
)
202 val autoindex_option
= fn (EApp ((EVar
"descriptionWidth", _
), w
), _
) =>
203 Option
.map (fn w
=> ("DescriptionWidth", SOME w
))
205 |
(EVar
"fancyIndexing", _
) => SOME ("FancyIndexing", NONE
)
206 |
(EVar
"foldersFirst", _
) => SOME ("FoldersFirst", NONE
)
207 |
(EVar
"htmlTable", _
) => SOME ("HTMLTable", NONE
)
208 |
(EVar
"iconsAreLinks", _
) => SOME ("IconsAreLinks", NONE
)
209 |
(EApp ((EVar
"iconHeight", _
), n
), _
) =>
210 Option
.map (fn w
=> ("IconHeight", SOME (Int.toString w
)))
212 |
(EApp ((EVar
"iconWidth", _
), n
), _
) =>
213 Option
.map (fn w
=> ("IconWidth", SOME (Int.toString w
)))
215 |
(EVar
"ignoreCase", _
) => SOME ("IgnoreCase", NONE
)
216 |
(EVar
"ignoreClient", _
) => SOME ("IgnoreClient", NONE
)
217 |
(EApp ((EVar
"nameWidth", _
), w
), _
) =>
218 Option
.map (fn w
=> ("NameWidth", SOME w
))
220 |
(EVar
"scanHtmlTitles", _
) => SOME ("ScanHTMLTitles", NONE
)
221 |
(EVar
"suppressColumnSorting", _
) => SOME ("SuppressColumnSorting", NONE
)
222 |
(EVar
"suppressDescription", _
) => SOME ("SuppressDescription", NONE
)
223 |
(EVar
"suppressHtmlPreamble", _
) => SOME ("SuppressHTMLPreamble", NONE
)
224 |
(EVar
"suppressIcon", _
) => SOME ("SuppressIcon", NONE
)
225 |
(EVar
"suppressLastModified", _
) => SOME ("SuppressLastModified", NONE
)
226 |
(EVar
"suppressRules", _
) => SOME ("SuppressRules", NONE
)
227 |
(EVar
"suppressSize", _
) => SOME ("SuppressSize", NONE
)
228 |
(EVar
"trackModified", _
) => SOME ("TrackModified", NONE
)
229 |
(EVar
"versionSort", _
) => SOME ("VersionSort", NONE
)
230 |
(EVar
"xhtml", _
) => SOME ("XHTML", NONE
)
234 val vhostsChanged
= ref
false
235 val logDeleted
= ref
false
237 val () = Slave
.registerPreHandler
238 (fn () => (vhostsChanged
:= false;
239 logDeleted
:= false))
241 fun findVhostUser fname
=
243 val inf
= TextIO.openIn fname
246 case TextIO.inputLine inf
of
249 if String.isPrefix
"# Owner: " line
then
250 case String.tokens
Char.isSpace line
of
251 [_
, _
, user
] => SOME user
257 before TextIO.closeIn inf
260 val webNodes_full
= Config
.Apache
.webNodes_all @ Config
.Apache
.webNodes_admin
262 fun isVersion1 node
=
263 List.exists (fn (n
, {version
= ConfigTypes
.APACHE_1_3
, ...}) => n
= node
264 | _
=> false) webNodes_full
266 fun imVersion1 () = isVersion1 (Slave
.hostname ())
269 List.exists (fn (n
, {auth
= ConfigTypes
.MOD_WAKLOG
, ...}) => n
= node
270 | _
=> false) webNodes_full
272 fun down () = if imVersion1 () then Config
.Apache
.down1
else Config
.Apache
.down
273 fun undown () = if imVersion1 () then Config
.Apache
.undown1
else Config
.Apache
.undown
274 fun reload () = if imVersion1 () then Config
.Apache
.reload1
else Config
.Apache
.reload
275 fun fixperms () = if imVersion1 () then Config
.Apache
.fixperms1
else Config
.Apache
.fixperms
277 fun logDir
{user
, node
, vhostId
} =
278 String.concat
[Config
.Apache
.logDirOf (isVersion1 node
) user
,
284 fun realLogDir
{user
, node
, vhostId
} =
285 String.concat
[Config
.Apache
.realLogDirOf user
,
291 val () = Slave
.registerFileHandler (fn fs
=>
293 val spl
= OS
.Path
.splitDirFile (#file fs
)
295 if String.isSuffix
".vhost" (#file spl
)
296 orelse String.isSuffix
".vhost_ssl" (#file spl
) then let
297 val realVhostFile
= OS
.Path
.joinDirFile
298 {dir
= Config
.Apache
.confDir
,
301 val user
= findVhostUser (#file fs
)
302 val oldUser
= case #action fs
of
303 Slave
.Delete
false => user
304 | _
=> findVhostUser realVhostFile
306 if (oldUser
= NONE
andalso #action fs
<> Slave
.Add
)
307 orelse (user
= NONE
andalso not (Slave
.isDelete (#action fs
))) then
308 print ("Can't find user in " ^ #file fs ^
" or " ^ realVhostFile ^
"! Taking no action.\n")
311 val vhostId
= if OS
.Path
.ext (#file spl
) = SOME
"vhost_ssl" then
312 OS
.Path
.base (#file spl
) ^
".ssl"
314 OS
.Path
.base (#file spl
)
316 fun realLogDir user
=
317 logDir
{user
= valOf user
,
318 node
= Slave
.hostname (),
323 {dir
= Config
.Apache
.backupLogDirOf
324 (isVersion1 (Slave
.hostname ())),
327 vhostsChanged
:= true;
331 val ldir
= realLogDir oldUser
336 (ignore (OS
.Process
.system (down ()));
337 ignore (OS
.Process
.system (fixperms ()));
339 ignore (OS
.Process
.system (Config
.rm
342 Slave
.moveDirCreate
{from
= ldir
,
347 val rld
= realLogDir user
349 ignore (OS
.Process
.system (Config
.cp
354 if Posix
.FileSys
.access (rld
, []) then
357 Slave
.moveDirCreate
{from
= backupLogs (),
362 (ignore (OS
.Process
.system (Config
.cp
367 if user
<> oldUser
then
369 val old
= realLogDir oldUser
370 val rld
= realLogDir user
375 (ignore (OS
.Process
.system (down ()));
377 ignore (OS
.Process
.system (Config
.rm
379 ^ realLogDir oldUser
));
380 if Posix
.FileSys
.access (rld
, []) then
393 val () = Slave
.registerPostHandler
395 (if !vhostsChanged
then
396 Slave
.shellF ([if !logDeleted
then undown () else reload ()],
397 fn cl
=> "Error reloading Apache with " ^ cl
)
401 val vhostFiles
: (string * TextIO.outstream
) list ref
= ref
[]
402 fun write
' s
= app (fn (node
, file
) => TextIO.output (file
, s node
)) (!vhostFiles
)
403 fun write s
= app (fn (_
, file
) => TextIO.output (file
, s
)) (!vhostFiles
)
405 val rewriteEnabled
= ref
false
406 val localRewriteEnabled
= ref
false
407 val currentVhost
= ref
""
408 val currentVhostId
= ref
""
409 val sslEnabled
= ref
false
411 val pre
= ref (fn _
: {user
: string, nodes
: string list
, id
: string, hostname
: string} => ())
416 pre
:= (fn x
=> (old x
; f x
))
419 val post
= ref (fn () => ())
424 post
:= (fn () => (old (); f ()))
428 fun doPost () = !post ()
430 val aliaser
= ref (fn _
: string => ())
431 fun registerAliaser f
=
435 aliaser
:= (fn x
=> (old x
; f x
))
438 val () = Env
.containerV_one
"vhost"
442 val places
= Env
.env (Env
.list webPlace
) (env
, "WebPlaces")
444 val ssl
= Env
.env
ssl (env
, "SSL")
445 val user
= Env
.env Env
.string (env
, "User")
446 val group
= Env
.env Env
.string (env
, "Group")
447 val docroot
= Env
.env Env
.string (env
, "DocumentRoot")
448 val sadmin
= Env
.env Env
.string (env
, "ServerAdmin")
449 val suexec
= Env
.env Env
.bool (env
, "SuExec")
451 val fullHost
= host ^
"." ^ Domain
.currentDomain ()
452 val vhostId
= fullHost ^
(if Option
.isSome ssl
then ".ssl" else "")
453 val confFile
= fullHost ^
(if Option
.isSome ssl
then ".vhost_ssl" else ".vhost")
455 currentVhost
:= fullHost
;
456 currentVhostId
:= vhostId
;
457 sslEnabled
:= Option
.isSome ssl
;
459 rewriteEnabled
:= false;
460 localRewriteEnabled
:= false;
461 vhostFiles
:= map (fn (node
, ip
) =>
463 val file
= Domain
.domainFile
{node
= node
,
466 val ld
= logDir
{user
= user
, node
= node
, vhostId
= vhostId
}
468 TextIO.output (file
, "# Owner: ");
469 TextIO.output (file
, user
);
470 TextIO.output (file
, "\n<VirtualHost ");
471 TextIO.output (file
, ip
);
472 TextIO.output (file
, ":");
473 TextIO.output (file
, case ssl
of
476 TextIO.output (file
, ">\n");
477 TextIO.output (file
, "\tErrorLog ");
478 TextIO.output (file
, ld
);
479 TextIO.output (file
, "/error.log\n\tCustomLog ");
480 TextIO.output (file
, ld
);
481 TextIO.output (file
, "/access.log combined\n");
482 TextIO.output (file
, "\tServerName ");
483 TextIO.output (file
, fullHost
);
485 (fn dom
=> (TextIO.output (file
, "\n\tServerAlias ");
486 TextIO.output (file
, host
);
487 TextIO.output (file
, ".");
488 TextIO.output (file
, dom
)))
489 (Domain
.currentAliasDomains ());
492 if isVersion1 node
then
493 (TextIO.output (file
, "\n\tUser ");
494 TextIO.output (file
, user
);
495 TextIO.output (file
, "\n\tGroup ");
496 TextIO.output (file
, group
))
498 (TextIO.output (file
, "\n\tSuexecUserGroup ");
499 TextIO.output (file
, user
);
500 TextIO.output (file
, " ");
501 TextIO.output (file
, group
))
505 if isWaklog node
then
506 (TextIO.output (file
, "\n\tWaklogEnabled on\n\tWaklogLocationPrincipal ");
507 TextIO.output (file
, user
);
508 TextIO.output (file
, "/daemon@HCOOP.NET /etc/keytabs/user.daemon/");
509 TextIO.output (file
, user
))
513 TextIO.output (file
, "\n\tDAVLockDB /var/lock/apache2/dav/");
514 TextIO.output (file
, user
);
515 TextIO.output (file
, "/DAVLock");
520 write
"\n\tDocumentRoot ";
522 write
"\n\tServerAdmin ";
526 (write
"\n\tSSLEngine on\n\tSSLCertificateFile ";
530 !pre
{user
= user
, nodes
= map #
1 places
, id
= vhostId
, hostname
= fullHost
};
531 app (fn dom
=> !aliaser (host ^
"." ^ dom
)) (Domain
.currentAliasDomains ())
534 write
"</VirtualHost>\n";
535 app (TextIO.closeOut
o #
2) (!vhostFiles
)))
537 val inLocal
= ref
false
539 val () = Env
.container_one
"location"
540 ("prefix", Env
.string)
542 (write
"\t<Location ";
546 fn () => (write
"\t</Location>\n";
548 localRewriteEnabled
:= false))
550 val () = Env
.container_one
"directory"
551 ("directory", Env
.string)
553 (write
"\t<Directory ";
557 fn () => (write
"\t</Directory>\n";
559 localRewriteEnabled
:= false))
561 fun checkRewrite () =
563 if !localRewriteEnabled
then
566 (write
"\tRewriteEngine on\n";
567 localRewriteEnabled
:= true)
568 else if !rewriteEnabled
then
571 (write
"\tRewriteEngine on\n";
572 rewriteEnabled
:= true)
574 val () = Env
.action_three
"localProxyRewrite"
575 ("from", Env
.string, "to", Env
.string, "port", Env
.int)
576 (fn (from
, to
, port
) =>
578 write
"\tRewriteRule\t";
580 write
"\thttp://localhost:";
581 write (Int.toString port
);
586 val () = Env
.action_two
"proxyPass"
587 ("from", Env
.string, "to", Env
.string)
589 (write
"\tProxyPass\t";
595 val () = Env
.action_two
"proxyPassReverse"
596 ("from", Env
.string, "to", Env
.string)
598 (write
"\tProxyPassReverse\t";
604 val () = Env
.action_three
"rewriteRule"
605 ("from", Env
.string, "to", Env
.string, "flags", Env
.list flag
)
606 (fn (from
, to
, flags
) =>
608 write
"\tRewriteRule\t";
614 | flag
::rest
=> (write
" [";
616 app (fn flag
=> (write
",";
621 val () = Env
.action_three
"rewriteCond"
622 ("test", Env
.string, "pattern", Env
.string, "flags", Env
.list cond_flag
)
623 (fn (from
, to
, flags
) =>
625 write
"\tRewriteCond\t";
631 | flag
::rest
=> (write
" [";
633 app (fn flag
=> (write
",";
638 val () = Env
.action_one
"rewriteBase"
639 ("prefix", Env
.string)
642 write
"\tRewriteBase\t";
646 val () = Env
.action_one
"rewriteLogLevel"
650 write
"\tRewriteLog ";
652 write
"/rewrite.log\n\tRewriteLogLevel ";
653 write (Int.toString level
);
656 val () = Env
.action_two
"alias"
657 ("from", Env
.string, "to", Env
.string)
665 val () = Env
.action_two
"scriptAlias"
666 ("from", Env
.string, "to", Env
.string)
668 (write
"\tScriptAlias\t";
674 val () = Env
.action_two
"errorDocument"
675 ("code", Env
.string, "handler", Env
.string)
676 (fn (code
, handler
) =>
678 val hasSpaces
= CharVector
.exists
Char.isSpace handler
686 write
"\tErrorDocument\t";
695 val () = Env
.action_one
"options"
696 ("options", Env
.list apache_option
)
700 | _
=> (write
"\tOptions";
701 app (fn opt
=> (write
" "; write opt
)) opts
;
704 val () = Env
.action_one
"set_options"
705 ("options", Env
.list apache_option
)
709 | _
=> (write
"\tOptions";
710 app (fn opt
=> (write
" +"; write opt
)) opts
;
713 val () = Env
.action_one
"unset_options"
714 ("options", Env
.list apache_option
)
718 | _
=> (write
"\tOptions";
719 app (fn opt
=> (write
" -"; write opt
)) opts
;
722 val () = Env
.action_one
"cgiExtension"
723 ("extension", Env
.string)
724 (fn ext
=> (write
"\tAddHandler cgi-script ";
728 val () = Env
.action_one
"directoryIndex"
729 ("filenames", Env
.list Env
.string)
731 (write
"\tDirectoryIndex";
732 app (fn opt
=> (write
" "; write opt
)) opts
;
735 val () = Env
.action_one
"serverAliasHost"
738 (write
"\tServerAlias ";
743 val () = Env
.action_one
"serverAlias"
749 val full
= host ^
"." ^ dom
751 write
"\tServerAlias ";
756 (Domain
.currentDomains ())))
758 val () = Env
.action_none
"serverAliasDefault"
762 (write
"\tServerAlias ";
766 (Domain
.currentDomains ())))
768 val authType
= fn (EVar
"basic", _
) => SOME
"basic"
769 |
(EVar
"digest", _
) => SOME
"digest"
770 |
(EVar
"kerberos", _
) => SOME
"kerberos"
773 fun allowAuthType
"kerberos" = !sslEnabled
774 | allowAuthType _
= true
776 val () = Env
.action_one
"authType"
779 if allowAuthType ty
then
780 (write
"\tAuthType ";
785 write
"\tKrbMethodNegotiate off\n\tKrbMethodK5Passwd on\n\tKrbVerifyKDC off\n\tKrbAuthRealms HCOOP.NET\n\tKrbSaveCredentials on\n"
788 print
"WARNING: Skipped Kerberos authType because this isn't an SSL vhost.\n")
790 val () = Env
.action_one
"authName"
793 (write
"\tAuthName \"";
797 val () = Env
.action_one
"authUserFile"
800 (write
"\tAuthUserFile ";
804 val () = Env
.action_none
"requireValidUser"
805 (fn () => write
"\tRequire valid-user\n")
807 val () = Env
.action_one
"requireUser"
808 ("users", Env
.list Env
.string)
812 | _
=> (write
"\tRequire user";
813 app (fn name
=> (write
" "; write name
)) names
;
816 val () = Env
.action_one
"requireGroup"
817 ("groups", Env
.list Env
.string)
821 | _
=> (write
"\tRequire group";
822 app (fn name
=> (write
" "; write name
)) names
;
825 val () = Env
.action_none
"orderAllowDeny"
826 (fn () => write
"\tOrder allow,deny\n")
828 val () = Env
.action_none
"orderDenyAllow"
829 (fn () => write
"\tOrder deny,allow\n")
831 val () = Env
.action_none
"allowFromAll"
832 (fn () => write
"\tAllow from all\n")
834 val () = Env
.action_one
"allowFrom"
835 ("entries", Env
.list Env
.string)
839 | _
=> (write
"\tAllow from";
840 app (fn name
=> (write
" "; write name
)) names
;
843 val () = Env
.action_none
"denyFromAll"
844 (fn () => write
"\tDeny from all\n")
846 val () = Env
.action_one
"denyFrom"
847 ("entries", Env
.list Env
.string)
851 | _
=> (write
"\tDeny from";
852 app (fn name
=> (write
" "; write name
)) names
;
855 val () = Env
.action_none
"satisfyAll"
856 (fn () => write
"\tSatisfy all\n")
858 val () = Env
.action_none
"satisfyAny"
859 (fn () => write
"\tSatisfy any\n")
861 val () = Env
.action_one
"forceType"
863 (fn ty
=> (write
"\tForceType ";
867 val () = Env
.action_none
"forceTypeOff"
868 (fn () => write
"\tForceType None\n")
870 val () = Env
.action_two
"action"
871 ("what", Env
.string, "how", Env
.string)
872 (fn (what
, how
) => (write
"\tAction ";
878 val () = Env
.action_one
"addDefaultCharset"
879 ("charset", Env
.string)
880 (fn ty
=> (write
"\tAddDefaultCharset ";
884 (*val () = Env
.action_one
"davSvn"
886 (fn path
=> (write
"\tDAV svn\n\tSVNPath ";
890 val () = Env
.action_one
"authzSvnAccessFile"
892 (fn path
=> (write
"\tAuthzSVNAccessFile ";
896 val () = Env
.action_none
"davFilesystem"
897 (fn path
=> write
"\tDAV filesystem\n")
899 val () = Env
.action_two
"addDescription"
900 ("description", Env
.string, "patterns", Env
.list Env
.string)
904 | _
=> (write
"\tAddDescription \"";
905 write (String.toString desc
);
907 app (fn pat
=> (write
" "; write pat
)) pats
;
910 val () = Env
.action_one
"indexOptions"
911 ("options", Env
.list autoindex_option
)
915 | _
=> (write
"\tIndexOptions";
916 app (fn (opt
, arg
) =>
919 Option
.app (fn arg
=>
920 (write
"="; write arg
)) arg
)) opts
;
923 val () = Env
.action_one
"set_indexOptions"
924 ("options", Env
.list autoindex_option
)
928 | _
=> (write
"\tIndexOptions";
929 app (fn (opt
, arg
) =>
932 Option
.app (fn arg
=>
933 (write
"="; write arg
)) arg
)) opts
;
936 val () = Env
.action_one
"unset_indexOptions"
937 ("options", Env
.list autoindex_option
)
941 | _
=> (write
"\tIndexOptions";
947 val () = Env
.action_one
"headerName"
949 (fn name
=> (write
"\tHeaderName ";
953 val () = Env
.action_one
"readmeName"
955 (fn name
=> (write
"\tReadmeName ";
959 val () = Env
.action_two
"setEnv"
960 ("key", Env
.string, "value", Env
.string)
961 (fn (key
, value
) => (write
"\tSetEnv \"";
964 write (String.translate (fn #
"\"" => "\\\""
965 | ch
=> str ch
) value
);
968 val () = Domain
.registerResetLocal (fn () =>
969 ignore (OS
.Process
.system (Config
.rm ^
" -rf /var/domtool/vhosts/*")))
971 val () = Domain
.registerDescriber (Domain
.considerAll
972 [Domain
.Extension
{extension
= "vhost",
973 heading
= fn host
=> "Web vhost " ^ host ^
":"},
974 Domain
.Extension
{extension
= "vhost_ssl",
975 heading
= fn host
=> "SSL web vhost " ^ host ^
":"}])