file_manager_example.anubis
1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
*Project* The Anubis Project
*Title*
*Copyright* Copyright (c) Alain Prouté 2005.
Not released. Must be finalized and debugged first.
read web/making_a_web_site.anubis
read web/multihost_http_server.anubis
read web/common.anubis
read web/file_manager.anubis
read web/mime.anubis
define String site_dir = ".".
type State:
state(String curdir).
define State
default
=
state(site_dir).
define HTML_Page
compute_page
(
State s
) =
if s is state(dir) then
html_page("",[],body([],center(
file_manager
(
(State s1) |-> if s1 is state(d) then d,
(State s1) |-> short
)(s)))).
global define One
web_file_manager
(
List(String) args
) =
start_web_sites
(
0,
1607,
1609,
"georges",
[
make_web_site_description
(
["127.0.0.1"],
site_dir,
(One u) |-> u,
(HTTP_Info i) |-> default,
(State s, HTTP_Info i, List(Web_arg) l, Bool h) |-> s,
(HTTP_Info i, List(Web_arg) l, Bool h) |-> default,
file_manager_actions
(
site_dir,
(State s) |-> true,
(State s) |-> if s is state(cd) then cd,
(State s, String d) |-> success(state(d)),
(State s, FileManagerLayout l) |-> s
),
compute_page,
(State s) |-> [], // additional HTTP headers
360000,
[
redirect("/","127.0.0.1","/fm.awp"),
],
"ISO-8859-1",
[".awp"],
["host","user-agent"],
"jhoierfcneirnze",
known_mime_types,
(String a, List(Web_arg) l) |-> unique
)
],
var((Bool)false)
).