Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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