Skip to content
Newer
Older
100644 270 lines (223 sloc) 8.55 KB
21abc5b @klacke Initial revision
authored
1 %%%----------------------------------------------------------------------
2 %%% File : yaws.hrl
3 %%% Author : Claes Wikstrom <klacke@hyber.org>
4 %%% Purpose :
5 %%% Created : 16 Jan 2002 by Claes Wikstrom <klacke@hyber.org>
6 %%%----------------------------------------------------------------------
7
8 -author('klacke@hyber.org').
3c06a9e @klacke rearr of includefiles
authored
9
21abc5b @klacke Initial revision
authored
10
7fd4ad4 @klacke backwards incomp cahnge with flags in gc and sc instead of many bools…
authored
11
12 %% flags for gconfs
14176e6 @klacke added feature to not pick first sconf when virthosting
authored
13 -define(GC_TTY_TRACE, 1).
14 -define(GC_DEBUG, 2).
15 -define(GC_AUTH_LOG, 4).
16 -define(GC_COPY_ERRLOG, 8).
17 -define(GC_BACKWARDS_COMPAT_PARSE, 16).
18 -define(GC_LOG_RESOLVE_HOSTNAME, 32).
19 -define(GC_FAIL_ON_BIND_ERR, 64).
20 -define(GC_PICK_FIRST_VIRTHOST_ON_NOMATCH, 128).
576139e @klacke added support for fdsrv
authored
21 -define(GC_USE_FDSRV, 256).
c9bd56d @klacke added config flag 'use_large_ssl_pool = bool()'
authored
22 -define(GC_USE_LARGE_SSL_POOL, 512).
7fd4ad4 @klacke backwards incomp cahnge with flags in gc and sc instead of many bools…
authored
23
92d0daf @klacke ""
authored
24 -define(GC_DEF, (?GC_AUTH_LOG bor ?GC_FAIL_ON_BIND_ERR)).
7fd4ad4 @klacke backwards incomp cahnge with flags in gc and sc instead of many bools…
authored
25
26 -define(gc_has_tty_trace(GC),
27 ((GC#gconf.flags band ?GC_TTY_TRACE) /= 0)).
28 -define(gc_has_debug(GC),
29 ((GC#gconf.flags band ?GC_DEBUG) /= 0)).
30 -define(gc_has_auth_log(GC),
31 ((GC#gconf.flags band ?GC_AUTH_LOG) /= 0)).
32 -define(gc_has_copy_errlog(GC),
33 ((GC#gconf.flags band ?GC_COPY_ERRLOG) /= 0)).
ef3a52a @klacke Removed the atoms in parse_post and parse query, backwards incompatib…
authored
34 -define(gc_has_backwards_compat_parse(GC),
35 ((GC#gconf.flags band ?GC_BACKWARDS_COMPAT_PARSE) /= 0)).
2ca4bda @klacke added client IP resolv for access log files
authored
36 -define(gc_log_has_resolve_hostname(GC),
37 ((GC#gconf.flags band ?GC_LOG_RESOLVE_HOSTNAME) /= 0)).
92d0daf @klacke ""
authored
38 -define(gc_fail_on_bind_err(GC),
39 ((GC#gconf.flags band ?GC_FAIL_ON_BIND_ERR) /= 0)).
14176e6 @klacke added feature to not pick first sconf when virthosting
authored
40 -define(gc_pick_first_virthost_on_nomatch(GC),
41 ((GC#gconf.flags band ?GC_PICK_FIRST_VIRTHOST_ON_NOMATCH) /= 0)).
576139e @klacke added support for fdsrv
authored
42 -define(gc_use_fdsrv(GC),
43 ((GC#gconf.flags band ?GC_USE_FDSRV) /= 0)).
c9bd56d @klacke added config flag 'use_large_ssl_pool = bool()'
authored
44 -define(gc_use_large_ssl_pool(GC),
45 ((GC#gconf.flags band ?GC_USE_LARGE_SSL_POOL) /= 0)).
7fd4ad4 @klacke backwards incomp cahnge with flags in gc and sc instead of many bools…
authored
46
47 -define(gc_set_tty_trace(GC, Bool),
48 GC#gconf{flags = yaws:flag(GC#gconf.flags,?GC_TTY_TRACE, Bool)}).
49 -define(gc_set_debug(GC, Bool),
50 GC#gconf{flags = yaws:flag(GC#gconf.flags, ?GC_DEBUG, Bool)}).
51 -define(gc_set_auth_log(GC, Bool),
52 GC#gconf{flags = yaws:flag(GC#gconf.flags, ?GC_AUTH_LOG, Bool)}).
53 -define(gc_set_copy_errlog(GC, Bool),
54 GC#gconf{flags = yaws:flag(GC#gconf.flags, ?GC_COPY_ERRLOG, Bool)}).
ef3a52a @klacke Removed the atoms in parse_post and parse query, backwards incompatib…
authored
55 -define(gc_set_backwards_compat_parse(GC, Bool),
56 GC#gconf{flags = yaws:flag(GC#gconf.flags,
57 ?GC_BACKWARDS_COMPAT_PARSE, Bool)}).
2ca4bda @klacke added client IP resolv for access log files
authored
58 -define(gc_log_set_resolve_hostname(GC, Bool),
14176e6 @klacke added feature to not pick first sconf when virthosting
authored
59 GC#gconf{flags = yaws:flag(GC#gconf.flags,
60 ?GC_LOG_RESOLVE_HOSTNAME, Bool)}).
92d0daf @klacke ""
authored
61 -define(gc_set_fail_on_bind_err(GC, Bool),
62 GC#gconf{flags = yaws:flag(GC#gconf.flags,?GC_FAIL_ON_BIND_ERR,Bool)}).
14176e6 @klacke added feature to not pick first sconf when virthosting
authored
63 -define(gc_set_pick_first_virthost_on_nomatch(GC, Bool),
64 GC#gconf{flags = yaws:flag(GC#gconf.flags,
65 ?GC_PICK_FIRST_VIRTHOST_ON_NOMATCH,Bool)}).
576139e @klacke added support for fdsrv
authored
66 -define(gc_set_use_fdsrv(GC, Bool),
67 GC#gconf{flags = yaws:flag(GC#gconf.flags,?GC_USE_FDSRV,Bool)}).
7fd4ad4 @klacke backwards incomp cahnge with flags in gc and sc instead of many bools…
authored
68
c9bd56d @klacke added config flag 'use_large_ssl_pool = bool()'
authored
69 -define(gc_set_use_large_ssl_pool(GC, Bool),
70 GC#gconf{flags = yaws:flag(GC#gconf.flags,?GC_USE_LARGE_SSL_POOL,Bool)}).
71
21abc5b @klacke Initial revision
authored
72 %% global conf
5ddf4f4 @klacke Bug fixed with bindings that got propagated over redirects. Good ol g…
authored
73 -record(gconf,{yaws_dir, %% topdir of Yaws installation
74 trace, %% false | {true,http}|{true,traffic}
75 flags = ?GC_DEF, %% boolean flags
76 logdir,
d69e4d8 @klacke ""
authored
77 ebin_dir = [],
5ddf4f4 @klacke Bug fixed with bindings that got propagated over redirects. Good ol g…
authored
78 runmods = [], %% runmods for entire server
21abc5b @klacke Initial revision
authored
79 keepalive_timeout = 15000,
80 max_num_cached_files = 400,
81 max_num_cached_bytes = 1000000, %% 1 MEG
f0b4192 @klacke ""
authored
82 max_size_cached_file = 8000,
fc117d0 *** empty log message ***
Johan Bevemyr authored
83 large_file_chunk_size = 10240,
92bafb4 @klacke removed the ability change userid, also stopped writing to /tmp/yaws …
authored
84 log_wrap_size = 10000000, % wrap logs after 10M
f0341a3 @klacke ""
authored
85 cache_refresh_secs = 30, % seconds (auto zero when debug)
5ddf4f4 @klacke Bug fixed with bindings that got propagated over redirects. Good ol g…
authored
86 include_dir = [], %% list of inc dirs for .yaws files
7b5fcf1 @klacke changed default php exe to php-cgi
authored
87 phpexe = "php-cgi", %% cgi capable php executable
f0341a3 @klacke ""
authored
88 yaws, %% server string
92bafb4 @klacke removed the ability change userid, also stopped writing to /tmp/yaws …
authored
89 %username, %% maybe run as a different user than root
90 %uid, %% unix uid of user that started yaws
91 id = "default", %% string identifying this instance of yaws
92 tmpdir
3dc56a7 @klacke javascript support in ehtml
authored
93 }).
94
21abc5b @klacke Initial revision
authored
95
96
661bd8c @klacke ""
authored
97 -record(ssl,
98 {
99 keyfile,
100 certfile,
101 verify = 0,
102 depth = 1,
103 password,
104 cacertfile,
105 ciphers,
106 cachetimeout}).
107
108
7fd4ad4 @klacke backwards incomp cahnge with flags in gc and sc instead of many bools…
authored
109 %% flags for sconfs
110 -define(SC_ACCESS_LOG, 1).
111 -define(SC_ADD_PORT, 2).
112 -define(SC_TILDE_EXPAND, 8).
113 -define(SC_DIR_LISTINGS, 16).
114 -define(SC_DEFLATE, 32).
2e8e005 @mbj4668 Added auto-generate all.zip to dir listings. It needs the zip command…
mbj4668 authored
115 -define(SC_DIR_ALL_ZIP, 64).
868ce8a @mbj4668 reworked the DAV support a bit - don't use an appmod, instead yaws ha…
mbj4668 authored
116 -define(SC_DAV, 128).
7fd4ad4 @klacke backwards incomp cahnge with flags in gc and sc instead of many bools…
authored
117
118 -define(SC_DEF, ?SC_ACCESS_LOG bor ?SC_ADD_PORT).
119
120 -define(sc_has_access_log(SC),
868ce8a @mbj4668 reworked the DAV support a bit - don't use an appmod, instead yaws ha…
mbj4668 authored
121 (((SC)#sconf.flags band ?SC_ACCESS_LOG) /= 0)).
7fd4ad4 @klacke backwards incomp cahnge with flags in gc and sc instead of many bools…
authored
122 -define(sc_has_add_port(SC),
868ce8a @mbj4668 reworked the DAV support a bit - don't use an appmod, instead yaws ha…
mbj4668 authored
123 (((SC)#sconf.flags band ?SC_ADD_PORT) /= 0)).
7fd4ad4 @klacke backwards incomp cahnge with flags in gc and sc instead of many bools…
authored
124 -define(sc_has_tilde_expand(SC),
868ce8a @mbj4668 reworked the DAV support a bit - don't use an appmod, instead yaws ha…
mbj4668 authored
125 (((SC)#sconf.flags band ?SC_TILDE_EXPAND) /= 0)).
7fd4ad4 @klacke backwards incomp cahnge with flags in gc and sc instead of many bools…
authored
126 -define(sc_has_dir_listings(SC),
868ce8a @mbj4668 reworked the DAV support a bit - don't use an appmod, instead yaws ha…
mbj4668 authored
127 (((SC)#sconf.flags band ?SC_DIR_LISTINGS) /= 0)).
7fd4ad4 @klacke backwards incomp cahnge with flags in gc and sc instead of many bools…
authored
128 -define(sc_has_deflate(SC),
868ce8a @mbj4668 reworked the DAV support a bit - don't use an appmod, instead yaws ha…
mbj4668 authored
129 (((SC)#sconf.flags band ?SC_DEFLATE) /= 0)).
2e8e005 @mbj4668 Added auto-generate all.zip to dir listings. It needs the zip command…
mbj4668 authored
130 -define(sc_has_dir_all_zip(SC),
868ce8a @mbj4668 reworked the DAV support a bit - don't use an appmod, instead yaws ha…
mbj4668 authored
131 (((SC)#sconf.flags band ?SC_DIR_ALL_ZIP) /= 0)).
132 -define(sc_has_dav(SC),
133 (((SC)#sconf.flags band ?SC_DAV) /= 0)).
7fd4ad4 @klacke backwards incomp cahnge with flags in gc and sc instead of many bools…
authored
134
3dc56a7 @klacke javascript support in ehtml
authored
135
7fd4ad4 @klacke backwards incomp cahnge with flags in gc and sc instead of many bools…
authored
136 -define(sc_set_access_log(SC, Bool),
137 SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_ACCESS_LOG, Bool)}).
138 -define(sc_set_add_port(SC, Bool),
139 SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_ADD_PORT, Bool)}).
140 -define(sc_set_ssl(SC, Bool),
141 SC#sconf{flags = yaws:flag(SC#sconf.flags , ?SC_SSL, Bool)}).
142 -define(sc_set_tilde_expand(SC, Bool),
143 SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_TILDE_EXPAND, Bool)}).
144 -define(sc_set_dir_listings(SC, Bool),
145 SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_DIR_LISTINGS, Bool)}).
146 -define(sc_set_deflate(SC, Bool),
147 SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_DEFLATE, Bool)}).
2e8e005 @mbj4668 Added auto-generate all.zip to dir listings. It needs the zip command…
mbj4668 authored
148 -define(sc_set_dir_all_zip(SC, Bool),
149 SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_DIR_ALL_ZIP, Bool)}).
868ce8a @mbj4668 reworked the DAV support a bit - don't use an appmod, instead yaws ha…
mbj4668 authored
150 -define(sc_set_dav(SC, Bool),
151 SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_DAV, Bool)}).
3dc56a7 @klacke javascript support in ehtml
authored
152
153
154
21abc5b @klacke Initial revision
authored
155 %% server conf
156 -record(sconf,
35208ae Fixed redirect_local
Johan Bevemyr authored
157 {port = 8000, %% which port is this server listening to
7fd4ad4 @klacke backwards incomp cahnge with flags in gc and sc instead of many bools…
authored
158 flags = ?SC_DEF,
c71921f Added redirect map
Johan Bevemyr authored
159 redirect_map=[], %% redirect all requests to HostPort
44a50e4 Added rhost option for setting explicit redirect host (and port if ne…
Johan Bevemyr authored
160 rhost, %% forced redirect host (+ optional port)
f48ee71 Fixed redirects and added rport and rmethod server settings.
Johan Bevemyr authored
161 rmethod, %% forced redirect method
0d6e5ea @klacke fixed tilde username expansion it didn't work, also made thta a confi…
authored
162 docroot, %% path to the docs
2c0aa59 @klacke added the possibilty to have multiple docroots, where a page is searc…
authored
163 xtra_docroots = [], %% if we have additional pseudo docroots
0d6e5ea @klacke fixed tilde username expansion it didn't work, also made thta a confi…
authored
164 listen = {127,0,0,1}, %% bind to this IP, {0,0,0,0} is possible
165 servername = "localhost", %% servername is what Host: header is
166 ets, %% local store for this server
661bd8c @klacke ""
authored
167 ssl,
55c9af7 Changed implementation of multipart form data. There is a new config
Seah Hinde authored
168 authdirs = [],
0d6e5ea @klacke fixed tilde username expansion it didn't work, also made thta a confi…
authored
169 partial_post_size = nolimit,
170 appmods = [], %% list of modules for this app
7cb9a46 @klacke customized crash messages
authored
171 errormod_404 = yaws_404, %% the default 404 error module
172 errormod_crash = yaws_404, %% use the same module for crashes
c3386b0 @klacke added arg_rewrite_mod
authored
173 arg_rewrite_mod = yaws,
b0837d6 More opaque stuff.
Tobbe Tornquist authored
174 opaque = [], %% useful in embedded mode
f0f2614 @carsten3347 Made allowed script types (yaws, php, cgi) configurable.
carsten3347 authored
175 start_mod, %% user provided module to be started
8e69e2c @klacke first almost working vsn of revproxy
authored
176 allowed_scripts = [yaws],
d7b3a5d @klacke backed off the is_default patch
authored
177 revproxy = []
21abc5b @klacke Initial revision
authored
178 }).
179
9199a36 @klacke added support for config changes without stopping the running systems…
authored
180 %% we cannot compare sconfs directly due to the ets
181 %% field in #sconf{} use yaws_config:eq_sconfs/2
182
0d6e5ea @klacke fixed tilde username expansion it didn't work, also made thta a confi…
authored
183
0dd21d2 Added Basic Authentication support with a new subsection to the serve…
Seah Hinde authored
184 % Auth conf - from server conf and .yaws_auth
185 -record(auth,
55c9af7 Changed implementation of multipart form data. There is a new config
Seah Hinde authored
186 {dir = [],
187 realm = "",
188 type = "Basic",
c5ebd38 @klacke added pam support + prepare for 1.58
authored
189 users = [],
190 pam = false % should we use pam to auth a user
55c9af7 Changed implementation of multipart form data. There is a new config
Seah Hinde authored
191 }).
21abc5b @klacke Initial revision
authored
192
3dc56a7 @klacke javascript support in ehtml
authored
193
00303e2 @klacke outh record, the outgoing headers are built up into a record now, muc…
authored
194
195 %% this internal record is used and returned by the URL path parser
196
197 -record(urltype, {type, %% error | yaws | regular | directory |
198 %% forbidden | appmod
199 finfo,
7c637eb @klacke rel/abs path patch by Rob Schmersel which fixed a problem in the wiki
authored
200 path = [],
201 fullpath = [], %% deep list
202 dir = [], %% relative dir where the path leads to
203 %% flat | unflat need flat for authentication
204 data, %% Binary | FileDescriptor | DirListing | undefined
ef3a52a @klacke Removed the atoms in parse_post and parse query, backwards incompatib…
authored
205 deflate, %% undefined | Binary | dynamic
00303e2 @klacke outh record, the outgoing headers are built up into a record now, muc…
authored
206 mime = "text/html", %% MIME type
ef3a52a @klacke Removed the atoms in parse_post and parse query, backwards incompatib…
authored
207 getpath, %% as GET'ed by client
6b289a9 @carsten3347 Added CGI and PHP support.
carsten3347 authored
208 pathinfo
00303e2 @klacke outh record, the outgoing headers are built up into a record now, muc…
authored
209 }).
210
211
212
213
214 %% this record is constructed as we build up
215 %% the outgoing headers
216
217 -record(outh, {
218 status, %% int status code
219
220 doclose, %% bool
221 chunked, %% bool
dc15586 @carsten3347 Support for `Content-Encoding: deflate' using zlib.
carsten3347 authored
222 encoding=identity,
223 %% identity, deflate
00303e2 @klacke outh record, the outgoing headers are built up into a record now, muc…
authored
224 contlen, %% integer
50d5504 @carsten3347 Log file size for dynamic pages.
carsten3347 authored
225 act_contlen, %% actual content length for dynamic pages
00303e2 @klacke outh record, the outgoing headers are built up into a record now, muc…
authored
226
227
228 %% and the total set of out headers we can have
229 %% as actual strings
230 connection,
231 server,
232 location,
233 cache_control,
234 date,
235 allow,
236 last_modified,
237 etag,
238 set_cookie,
0a0a859 @carsten3347 For GETs on regular files:
carsten3347 authored
239 content_range,
00303e2 @klacke outh record, the outgoing headers are built up into a record now, muc…
authored
240 content_length,
241 content_type,
dc15586 @carsten3347 Support for `Content-Encoding: deflate' using zlib.
carsten3347 authored
242 content_encoding,
00303e2 @klacke outh record, the outgoing headers are built up into a record now, muc…
authored
243 transfer_encoding,
06a1bef @klacke ""
authored
244 www_authenticate,
245 other %% misc other headers
246 }).
00303e2 @klacke outh record, the outgoing headers are built up into a record now, muc…
authored
247
248
249
ef3a52a @klacke Removed the atoms in parse_post and parse query, backwards incompatib…
authored
250 -define(READ_TIMEOUT, 30000).
251
b67bbd8 @klacke Rewrote url splitting (again), and made the redir to index.{html,yaws…
authored
252
253
254
255 -record(appmodspec, {
256 type, %% atom, pair or absolute
257 data}).
258
31fdaae @klacke pam cleanup, add env record, yaws_ls enhancements by doccarcass@gmail…
authored
259
260 %% as read by application:get_env()
261 -record(env, {debug,
262 trace,
263 traceoutput,
264 conf,
265 runmod,
92bafb4 @klacke removed the ability change userid, also stopped writing to /tmp/yaws …
authored
266 embedded,
267 id
268 }).
31fdaae @klacke pam cleanup, add env record, yaws_ls enhancements by doccarcass@gmail…
authored
269
Something went wrong with that request. Please try again.