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")
90 size s
> 0 andalso size s
< 1000 andalso CharVector
.all
91 (fn ch
=> Char.isAlphaNum ch
97 val _
= Env
.type_one
"location"
101 fun validCert s
= Acl
.query
{user
= Domain
.getUser (),
105 val _
= Env
.type_one
"ssl_cert_path"
109 fun ssl e
= case e
of
110 (EVar
"no_ssl", _
) => SOME NONE
111 |
(EApp ((EVar
"use_cert", _
), s
), _
) => Option
.map
SOME (Env
.string s
)
114 fun validExtension s
=
117 andalso CharVector
.all (fn ch
=> Char.isAlphaNum ch
orelse ch
= #
"_") s
119 val _
= Env
.type_one
"file_extension"
123 val defaults
= [("WebPlaces",
124 (TList (TBase
"web_place", dl
), dl
),
125 (fn () => (EList (map webPlaceDefault Config
.Apache
.webNodes_default
), dl
))),
128 (fn () => (EVar
"no_ssl", dl
))),
130 (TBase
"your_user", dl
),
131 (fn () => (EString (Domain
.getUser ()), dl
))),
133 (TBase
"your_group", dl
),
134 (fn () => (EString
"nogroup", dl
))),
136 (TBase
"your_path", dl
),
137 (fn () => (EString (Domain
.homedir () ^
"/" ^ Config
.Apache
.public_html
), dl
))),
140 (fn () => (EString (Domain
.getUser () ^
"@" ^ Config
.defaultDomain
), dl
))),
142 (TBase
"suexec_flag", dl
),
143 (fn () => (EVar
"true", dl
)))]
145 val () = app Defaults
.registerDefault defaults
147 val redirect_code
= fn (EVar
"temp", _
) => SOME
"temp"
148 |
(EVar
"permanent", _
) => SOME
"permanent"
149 |
(EVar
"seeother", _
) => SOME
"seeother"
150 |
(EVar
"redir300", _
) => SOME
"300"
151 |
(EVar
"redir301", _
) => SOME
"301"
152 |
(EVar
"redir302", _
) => SOME
"302"
153 |
(EVar
"redir303", _
) => SOME
"303"
154 |
(EVar
"redir304", _
) => SOME
"304"
155 |
(EVar
"redir305", _
) => SOME
"305"
156 |
(EVar
"redir307", _
) => SOME
"307"
159 val flag
= fn (EVar
"redirect", _
) => SOME
"R"
160 |
(EVar
"forbidden", _
) => SOME
"F"
161 |
(EVar
"gone", _
) => SOME
"G"
162 |
(EVar
"last", _
) => SOME
"L"
163 |
(EVar
"chain", _
) => SOME
"C"
164 |
(EVar
"nosubreq", _
) => SOME
"NS"
165 |
(EVar
"nocase", _
) => SOME
"NC"
166 |
(EVar
"qsappend", _
) => SOME
"QSA"
167 |
(EVar
"noescape", _
) => SOME
"NE"
168 |
(EVar
"passthrough", _
) => SOME
"PT"
169 |
(EApp ((EVar
"mimeType", _
), e
), _
) =>
170 Option
.map (fn s
=> "T=" ^ s
) (Env
.string e
)
171 |
(EApp ((EVar
"redirectWith", _
), e
), _
) =>
172 Option
.map (fn s
=> "R=" ^ s
) (redirect_code e
)
173 |
(EApp ((EVar
"skip", _
), e
), _
) =>
174 Option
.map (fn n
=> "S=" ^
Int.toString n
) (Env
.int e
)
175 |
(EApp ((EApp ((EVar
"env", _
), e1
), _
), e2
), _
) =>
176 (case Env
.string e1
of
178 | SOME s1
=> Option
.map (fn s2
=> "E=" ^ s1 ^
":" ^ s2
)
183 val cond_flag
= fn (EVar
"cond_nocase", _
) => SOME
"NC"
184 |
(EVar
"ornext", _
) => SOME
"OR"
187 val apache_option
= fn (EVar
"execCGI", _
) => SOME
"ExecCGI"
188 |
(EVar
"includesNOEXEC", _
) => SOME
"IncludesNOEXEC"
189 |
(EVar
"indexes", _
) => SOME
"Indexes"
190 |
(EVar
"followSymLinks", _
) => SOME
"FollowSymLinks"
193 val autoindex_width
= fn (EVar
"autofit", _
) => SOME
"*"
194 |
(EApp ((EVar
"characters", _
), n
), _
) =>
195 Option
.map
Int.toString (Env
.int n
)
198 val autoindex_option
= fn (EApp ((EVar
"descriptionWidth", _
), w
), _
) =>
199 Option
.map (fn w
=> ("DescriptionWidth", SOME w
))
201 |
(EVar
"fancyIndexing", _
) => SOME ("FancyIndexing", NONE
)
202 |
(EVar
"foldersFirst", _
) => SOME ("FoldersFirst", NONE
)
203 |
(EVar
"htmlTable", _
) => SOME ("HTMLTable", NONE
)
204 |
(EVar
"iconsAreLinks", _
) => SOME ("IconsAreLinks", NONE
)
205 |
(EApp ((EVar
"iconHeight", _
), n
), _
) =>
206 Option
.map (fn w
=> ("IconHeight", SOME (Int.toString w
)))
208 |
(EApp ((EVar
"iconWidth", _
), n
), _
) =>
209 Option
.map (fn w
=> ("IconWidth", SOME (Int.toString w
)))
211 |
(EVar
"ignoreCase", _
) => SOME ("IgnoreCase", NONE
)
212 |
(EVar
"ignoreClient", _
) => SOME ("IgnoreClient", NONE
)
213 |
(EApp ((EVar
"nameWidth", _
), w
), _
) =>
214 Option
.map (fn w
=> ("NameWidth", SOME w
))
216 |
(EVar
"scanHtmlTitles", _
) => SOME ("ScanHTMLTitles", NONE
)
217 |
(EVar
"suppressColumnSorting", _
) => SOME ("SuppressColumnSorting", NONE
)
218 |
(EVar
"suppressDescription", _
) => SOME ("SuppressDescription", NONE
)
219 |
(EVar
"suppressHtmlPreamble", _
) => SOME ("SuppressHTMLPreamble", NONE
)
220 |
(EVar
"suppressIcon", _
) => SOME ("SuppressIcon", NONE
)
221 |
(EVar
"suppressLastModified", _
) => SOME ("SuppressLastModified", NONE
)
222 |
(EVar
"suppressRules", _
) => SOME ("SuppressRules", NONE
)
223 |
(EVar
"suppressSize", _
) => SOME ("SuppressSize", NONE
)
224 |
(EVar
"trackModified", _
) => SOME ("TrackModified", NONE
)
225 |
(EVar
"versionSort", _
) => SOME ("VersionSort", NONE
)
226 |
(EVar
"xhtml", _
) => SOME ("XHTML", NONE
)
230 val vhostsChanged
= ref
false
231 val logDeleted
= ref
false
233 val () = Slave
.registerPreHandler
234 (fn () => (vhostsChanged
:= false;
235 logDeleted
:= false))
237 fun findVhostUser fname
=
239 val inf
= TextIO.openIn fname
242 case TextIO.inputLine inf
of
245 if String.isPrefix
"# Owner: " line
then
246 case String.tokens
Char.isSpace line
of
247 [_
, _
, user
] => SOME user
253 before TextIO.closeIn inf
256 val webNodes_full
= Config
.Apache
.webNodes_all @ Config
.Apache
.webNodes_admin
258 fun isVersion1 node
=
259 List.exists (fn (n
, {version
= ConfigTypes
.APACHE_1_3
, ...}) => n
= node
260 | _
=> false) webNodes_full
262 fun imVersion1 () = isVersion1 (Slave
.hostname ())
265 List.exists (fn (n
, {auth
= ConfigTypes
.MOD_WAKLOG
, ...}) => n
= node
266 | _
=> false) webNodes_full
268 fun down () = if imVersion1 () then Config
.Apache
.down1
else Config
.Apache
.down
269 fun undown () = if imVersion1 () then Config
.Apache
.undown1
else Config
.Apache
.undown
270 fun reload () = if imVersion1 () then Config
.Apache
.reload1
else Config
.Apache
.reload
271 fun fixperms () = if imVersion1 () then Config
.Apache
.fixperms1
else Config
.Apache
.fixperms
273 fun logDir
{user
, node
, vhostId
} =
274 String.concat
[Config
.Apache
.logDirOf (isVersion1 node
) user
,
280 fun realLogDir
{user
, node
, vhostId
} =
281 String.concat
[Config
.Apache
.realLogDirOf user
,
287 val () = Slave
.registerFileHandler (fn fs
=>
289 val spl
= OS
.Path
.splitDirFile (#file fs
)
291 if String.isSuffix
".vhost" (#file spl
)
292 orelse String.isSuffix
".vhost_ssl" (#file spl
) then let
293 val realVhostFile
= OS
.Path
.joinDirFile
294 {dir
= Config
.Apache
.confDir
,
297 val user
= findVhostUser (#file fs
)
298 val oldUser
= case #action fs
of
299 Slave
.Delete
false => user
300 | _
=> findVhostUser realVhostFile
302 if (oldUser
= NONE
andalso #action fs
<> Slave
.Add
)
303 orelse (user
= NONE
andalso not (Slave
.isDelete (#action fs
))) then
304 print ("Can't find user in " ^ #file fs ^
" or " ^ realVhostFile ^
"! Taking no action.\n")
307 val vhostId
= if OS
.Path
.ext (#file spl
) = SOME
"vhost_ssl" then
308 OS
.Path
.base (#file spl
) ^
".ssl"
310 OS
.Path
.base (#file spl
)
312 fun realLogDir user
=
313 logDir
{user
= valOf user
,
314 node
= Slave
.hostname (),
319 {dir
= Config
.Apache
.backupLogDirOf
320 (isVersion1 (Slave
.hostname ())),
323 vhostsChanged
:= true;
327 val ldir
= realLogDir oldUser
332 (ignore (OS
.Process
.system (down ()));
333 ignore (OS
.Process
.system (fixperms ()));
335 ignore (OS
.Process
.system (Config
.rm
338 Slave
.moveDirCreate
{from
= ldir
,
343 val rld
= realLogDir user
345 ignore (OS
.Process
.system (Config
.cp
350 if Posix
.FileSys
.access (rld
, []) then
353 Slave
.moveDirCreate
{from
= backupLogs (),
358 (ignore (OS
.Process
.system (Config
.cp
363 if user
<> oldUser
then
365 val old
= realLogDir oldUser
366 val rld
= realLogDir user
371 (ignore (OS
.Process
.system (down ()));
373 ignore (OS
.Process
.system (Config
.rm
375 ^ realLogDir oldUser
));
376 if Posix
.FileSys
.access (rld
, []) then
389 val () = Slave
.registerPostHandler
391 (if !vhostsChanged
then
392 Slave
.shellF ([if !logDeleted
then undown () else reload ()],
393 fn cl
=> "Error reloading Apache with " ^ cl
)
397 val vhostFiles
: (string * TextIO.outstream
) list ref
= ref
[]
398 fun write
' s
= app (fn (node
, file
) => TextIO.output (file
, s node
)) (!vhostFiles
)
399 fun write s
= app (fn (_
, file
) => TextIO.output (file
, s
)) (!vhostFiles
)
401 val rewriteEnabled
= ref
false
402 val localRewriteEnabled
= ref
false
403 val currentVhost
= ref
""
404 val currentVhostId
= ref
""
405 val sslEnabled
= ref
false
407 val pre
= ref (fn _
: {user
: string, nodes
: string list
, id
: string, hostname
: string} => ())
412 pre
:= (fn x
=> (old x
; f x
))
415 val post
= ref (fn () => ())
420 post
:= (fn () => (old (); f ()))
424 fun doPost () = !post ()
426 val aliaser
= ref (fn _
: string => ())
427 fun registerAliaser f
=
431 aliaser
:= (fn x
=> (old x
; f x
))
434 val () = Env
.containerV_one
"vhost"
438 val places
= Env
.env (Env
.list webPlace
) (env
, "WebPlaces")
440 val ssl
= Env
.env
ssl (env
, "SSL")
441 val user
= Env
.env Env
.string (env
, "User")
442 val group
= Env
.env Env
.string (env
, "Group")
443 val docroot
= Env
.env Env
.string (env
, "DocumentRoot")
444 val sadmin
= Env
.env Env
.string (env
, "ServerAdmin")
445 val suexec
= Env
.env Env
.bool (env
, "SuExec")
447 val fullHost
= host ^
"." ^ Domain
.currentDomain ()
448 val vhostId
= fullHost ^
(if Option
.isSome ssl
then ".ssl" else "")
449 val confFile
= fullHost ^
(if Option
.isSome ssl
then ".vhost_ssl" else ".vhost")
451 currentVhost
:= fullHost
;
452 currentVhostId
:= vhostId
;
453 sslEnabled
:= Option
.isSome ssl
;
455 rewriteEnabled
:= false;
456 localRewriteEnabled
:= false;
457 vhostFiles
:= map (fn (node
, ip
) =>
459 val file
= Domain
.domainFile
{node
= node
,
462 val ld
= logDir
{user
= user
, node
= node
, vhostId
= vhostId
}
464 TextIO.output (file
, "# Owner: ");
465 TextIO.output (file
, user
);
466 TextIO.output (file
, "\n<VirtualHost ");
467 TextIO.output (file
, ip
);
468 TextIO.output (file
, ":");
469 TextIO.output (file
, case ssl
of
472 TextIO.output (file
, ">\n");
473 TextIO.output (file
, "\tErrorLog ");
474 TextIO.output (file
, ld
);
475 TextIO.output (file
, "/error.log\n\tCustomLog ");
476 TextIO.output (file
, ld
);
477 TextIO.output (file
, "/access.log combined\n");
478 TextIO.output (file
, "\tServerName ");
479 TextIO.output (file
, fullHost
);
481 (fn dom
=> (TextIO.output (file
, "\n\tServerAlias ");
482 TextIO.output (file
, host
);
483 TextIO.output (file
, ".");
484 TextIO.output (file
, dom
)))
485 (Domain
.currentAliasDomains ());
488 if isVersion1 node
then
489 (TextIO.output (file
, "\n\tUser ");
490 TextIO.output (file
, user
);
491 TextIO.output (file
, "\n\tGroup ");
492 TextIO.output (file
, group
))
494 (TextIO.output (file
, "\n\tSuexecUserGroup ");
495 TextIO.output (file
, user
);
496 TextIO.output (file
, " ");
497 TextIO.output (file
, group
))
501 if isWaklog node
then
502 (TextIO.output (file
, "\n\tWaklogEnabled on\n\tWaklogLocationPrincipal ");
503 TextIO.output (file
, user
);
504 TextIO.output (file
, "/daemon@HCOOP.NET /etc/keytabs/user.daemon/");
505 TextIO.output (file
, user
))
509 TextIO.output (file
, "\n\tDAVLockDB /var/lock/apache2/dav/");
510 TextIO.output (file
, user
);
511 TextIO.output (file
, "/DAVLock");
516 write
"\n\tDocumentRoot ";
518 write
"\n\tServerAdmin ";
522 (write
"\n\tSSLEngine on\n\tSSLCertificateFile ";
526 !pre
{user
= user
, nodes
= map #
1 places
, id
= vhostId
, hostname
= fullHost
};
527 app (fn dom
=> !aliaser (host ^
"." ^ dom
)) (Domain
.currentAliasDomains ())
530 write
"</VirtualHost>\n";
531 app (TextIO.closeOut
o #
2) (!vhostFiles
)))
533 val inLocal
= ref
false
535 val () = Env
.container_one
"location"
536 ("prefix", Env
.string)
538 (write
"\t<Location ";
542 fn () => (write
"\t</Location>\n";
544 localRewriteEnabled
:= false))
546 val () = Env
.container_one
"directory"
547 ("directory", Env
.string)
549 (write
"\t<Directory ";
553 fn () => (write
"\t</Directory>\n";
555 localRewriteEnabled
:= false))
557 fun checkRewrite () =
559 if !localRewriteEnabled
then
562 (write
"\tRewriteEngine on\n";
563 localRewriteEnabled
:= true)
564 else if !rewriteEnabled
then
567 (write
"\tRewriteEngine on\n";
568 rewriteEnabled
:= true)
570 val () = Env
.action_three
"localProxyRewrite"
571 ("from", Env
.string, "to", Env
.string, "port", Env
.int)
572 (fn (from
, to
, port
) =>
574 write
"\tRewriteRule\t";
576 write
"\thttp://localhost:";
577 write (Int.toString port
);
582 val () = Env
.action_two
"proxyPass"
583 ("from", Env
.string, "to", Env
.string)
585 (write
"\tProxyPass\t";
591 val () = Env
.action_two
"proxyPassReverse"
592 ("from", Env
.string, "to", Env
.string)
594 (write
"\tProxyPassReverse\t";
600 val () = Env
.action_three
"rewriteRule"
601 ("from", Env
.string, "to", Env
.string, "flags", Env
.list flag
)
602 (fn (from
, to
, flags
) =>
604 write
"\tRewriteRule\t";
610 | flag
::rest
=> (write
" [";
612 app (fn flag
=> (write
",";
617 val () = Env
.action_three
"rewriteCond"
618 ("test", Env
.string, "pattern", Env
.string, "flags", Env
.list cond_flag
)
619 (fn (from
, to
, flags
) =>
621 write
"\tRewriteCond\t";
627 | flag
::rest
=> (write
" [";
629 app (fn flag
=> (write
",";
634 val () = Env
.action_one
"rewriteBase"
635 ("prefix", Env
.string)
638 write
"\tRewriteBase\t";
642 val () = Env
.action_one
"rewriteLogLevel"
646 write
"\tRewriteLog ";
648 write
"/rewrite.log\n\tRewriteLogLevel ";
649 write (Int.toString level
);
652 val () = Env
.action_two
"alias"
653 ("from", Env
.string, "to", Env
.string)
661 val () = Env
.action_two
"scriptAlias"
662 ("from", Env
.string, "to", Env
.string)
664 (write
"\tScriptAlias\t";
670 val () = Env
.action_two
"errorDocument"
671 ("code", Env
.string, "handler", Env
.string)
672 (fn (code
, handler
) =>
674 val hasSpaces
= CharVector
.exists
Char.isSpace handler
682 write
"\tErrorDocument\t";
691 val () = Env
.action_one
"options"
692 ("options", Env
.list apache_option
)
696 | _
=> (write
"\tOptions";
697 app (fn opt
=> (write
" "; write opt
)) opts
;
700 val () = Env
.action_one
"set_options"
701 ("options", Env
.list apache_option
)
705 | _
=> (write
"\tOptions";
706 app (fn opt
=> (write
" +"; write opt
)) opts
;
709 val () = Env
.action_one
"unset_options"
710 ("options", Env
.list apache_option
)
714 | _
=> (write
"\tOptions";
715 app (fn opt
=> (write
" -"; write opt
)) opts
;
718 val () = Env
.action_one
"cgiExtension"
719 ("extension", Env
.string)
720 (fn ext
=> (write
"\tAddHandler cgi-script ";
724 val () = Env
.action_one
"directoryIndex"
725 ("filenames", Env
.list Env
.string)
727 (write
"\tDirectoryIndex";
728 app (fn opt
=> (write
" "; write opt
)) opts
;
731 val () = Env
.action_one
"serverAliasHost"
734 (write
"\tServerAlias ";
739 val () = Env
.action_one
"serverAlias"
745 val full
= host ^
"." ^ dom
747 write
"\tServerAlias ";
752 (Domain
.currentDomains ())))
754 val () = Env
.action_none
"serverAliasDefault"
758 (write
"\tServerAlias ";
762 (Domain
.currentDomains ())))
764 val authType
= fn (EVar
"basic", _
) => SOME
"basic"
765 |
(EVar
"digest", _
) => SOME
"digest"
766 |
(EVar
"kerberos", _
) => SOME
"kerberos"
769 fun allowAuthType
"kerberos" = !sslEnabled
770 | allowAuthType _
= true
772 val () = Env
.action_one
"authType"
775 if allowAuthType ty
then
776 (write
"\tAuthType ";
781 write
"\tKrbMethodNegotiate off\n\tKrbMethodK5Passwd on\n\tKrbVerifyKDC off\n\tKrbAuthRealms HCOOP.NET\n\tKrbSaveCredentials on\n"
784 print
"WARNING: Skipped Kerberos authType because this isn't an SSL vhost.\n")
786 val () = Env
.action_one
"authName"
789 (write
"\tAuthName \"";
793 val () = Env
.action_one
"authUserFile"
796 (write
"\tAuthUserFile ";
800 val () = Env
.action_none
"requireValidUser"
801 (fn () => write
"\tRequire valid-user\n")
803 val () = Env
.action_one
"requireUser"
804 ("users", Env
.list Env
.string)
808 | _
=> (write
"\tRequire user";
809 app (fn name
=> (write
" "; write name
)) names
;
812 val () = Env
.action_one
"requireGroup"
813 ("groups", Env
.list Env
.string)
817 | _
=> (write
"\tRequire group";
818 app (fn name
=> (write
" "; write name
)) names
;
821 val () = Env
.action_none
"orderAllowDeny"
822 (fn () => write
"\tOrder allow,deny\n")
824 val () = Env
.action_none
"orderDenyAllow"
825 (fn () => write
"\tOrder deny,allow\n")
827 val () = Env
.action_none
"allowFromAll"
828 (fn () => write
"\tAllow from all\n")
830 val () = Env
.action_one
"allowFrom"
831 ("entries", Env
.list Env
.string)
835 | _
=> (write
"\tAllow from";
836 app (fn name
=> (write
" "; write name
)) names
;
839 val () = Env
.action_none
"denyFromAll"
840 (fn () => write
"\tDeny from all\n")
842 val () = Env
.action_one
"denyFrom"
843 ("entries", Env
.list Env
.string)
847 | _
=> (write
"\tDeny from";
848 app (fn name
=> (write
" "; write name
)) names
;
851 val () = Env
.action_none
"satisfyAll"
852 (fn () => write
"\tSatisfy all\n")
854 val () = Env
.action_none
"satisfyAny"
855 (fn () => write
"\tSatisfy any\n")
857 val () = Env
.action_one
"forceType"
859 (fn ty
=> (write
"\tForceType ";
863 val () = Env
.action_none
"forceTypeOff"
864 (fn () => write
"\tForceType None\n")
866 val () = Env
.action_two
"action"
867 ("what", Env
.string, "how", Env
.string)
868 (fn (what
, how
) => (write
"\tAction ";
874 val () = Env
.action_one
"addDefaultCharset"
875 ("charset", Env
.string)
876 (fn ty
=> (write
"\tAddDefaultCharset ";
880 (*val () = Env
.action_one
"davSvn"
882 (fn path
=> (write
"\tDAV svn\n\tSVNPath ";
886 val () = Env
.action_one
"authzSvnAccessFile"
888 (fn path
=> (write
"\tAuthzSVNAccessFile ";
892 val () = Env
.action_none
"davFilesystem"
893 (fn path
=> write
"\tDAV filesystem\n")
895 val () = Env
.action_two
"addDescription"
896 ("description", Env
.string, "patterns", Env
.list Env
.string)
900 | _
=> (write
"\tAddDescription \"";
901 write (String.toString desc
);
903 app (fn pat
=> (write
" "; write pat
)) pats
;
906 val () = Env
.action_one
"indexOptions"
907 ("options", Env
.list autoindex_option
)
911 | _
=> (write
"\tIndexOptions";
912 app (fn (opt
, arg
) =>
915 Option
.app (fn arg
=>
916 (write
"="; write arg
)) arg
)) opts
;
919 val () = Env
.action_one
"set_indexOptions"
920 ("options", Env
.list autoindex_option
)
924 | _
=> (write
"\tIndexOptions";
925 app (fn (opt
, arg
) =>
928 Option
.app (fn arg
=>
929 (write
"="; write arg
)) arg
)) opts
;
932 val () = Env
.action_one
"unset_indexOptions"
933 ("options", Env
.list autoindex_option
)
937 | _
=> (write
"\tIndexOptions";
943 val () = Env
.action_one
"headerName"
945 (fn name
=> (write
"\tHeaderName ";
949 val () = Env
.action_one
"readmeName"
951 (fn name
=> (write
"\tReadmeName ";
955 val () = Env
.action_two
"setEnv"
956 ("key", Env
.string, "value", Env
.string)
957 (fn (key
, value
) => (write
"\tSetEnv \"";
960 write (String.translate (fn #
"\"" => "\\\""
961 | ch
=> str ch
) value
);
964 val () = Domain
.registerResetLocal (fn () =>
965 ignore (OS
.Process
.system (Config
.rm ^
" -rf /var/domtool/vhosts/*")))
967 val () = Domain
.registerDescriber (Domain
.considerAll
968 [Domain
.Extension
{extension
= "vhost",
969 heading
= fn host
=> "Web vhost " ^ host ^
":"},
970 Domain
.Extension
{extension
= "vhost_ssl",
971 heading
= fn host
=> "SSL web vhost " ^ host ^
":"}])