Skip to content

HTTPS clone URL

Subversion checkout URL

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