Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 203 lines (161 sloc) 5.719 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
13 -define(GC_TTY_TRACE, 1).
14 -define(GC_DEBUG, 2).
15 -define(GC_AUTH_LOG, 4).
16 -define(GC_COPY_ERRLOG, 8).
17
18
19 -define(GC_DEF, ?GC_AUTH_LOG).
20
21 -define(gc_has_tty_trace(GC),
22 ((GC#gconf.flags band ?GC_TTY_TRACE) /= 0)).
23 -define(gc_has_debug(GC),
24 ((GC#gconf.flags band ?GC_DEBUG) /= 0)).
25 -define(gc_has_auth_log(GC),
26 ((GC#gconf.flags band ?GC_AUTH_LOG) /= 0)).
27 -define(gc_has_copy_errlog(GC),
28 ((GC#gconf.flags band ?GC_COPY_ERRLOG) /= 0)).
29
30 -define(gc_set_tty_trace(GC, Bool),
31 GC#gconf{flags = yaws:flag(GC#gconf.flags,?GC_TTY_TRACE, Bool)}).
32 -define(gc_set_debug(GC, Bool),
33 GC#gconf{flags = yaws:flag(GC#gconf.flags, ?GC_DEBUG, Bool)}).
34 -define(gc_set_auth_log(GC, Bool),
35 GC#gconf{flags = yaws:flag(GC#gconf.flags, ?GC_AUTH_LOG, Bool)}).
36 -define(gc_set_copy_errlog(GC, Bool),
37 GC#gconf{flags = yaws:flag(GC#gconf.flags, ?GC_COPY_ERRLOG, Bool)}).
38
39
40
21abc5b @klacke Initial revision
authored
41 %% global conf
7fd4ad4 @klacke backwards incomp cahnge with flags in gc and sc instead of many bools, c...
authored
42 -record(gconf,{yaws_dir,
961926f @klacke ""
authored
43 trace,
7fd4ad4 @klacke backwards incomp cahnge with flags in gc and sc instead of many bools, c...
authored
44 flags = ?GC_DEF,
21abc5b @klacke Initial revision
authored
45 logdir,
d69e4d8 @klacke ""
authored
46 ebin_dir = [],
8d5aa60 @klacke ""
authored
47 runmods = [],
21abc5b @klacke Initial revision
authored
48 keepalive_timeout = 15000,
49 max_num_cached_files = 400,
50 max_num_cached_bytes = 1000000, %% 1 MEG
f0b4192 @klacke ""
authored
51 max_size_cached_file = 8000,
fc117d0 *** empty log message ***
Johan Bevemyr authored
52 large_file_chunk_size = 10240,
f0341a3 @klacke ""
authored
53 cache_refresh_secs = 30, % seconds (auto zero when debug)
21abc5b @klacke Initial revision
authored
54 default_type = "text/html",
d3e0fa3 Upped read timeout and made it configurable
Johan Bevemyr authored
55 timeout = 30000,
d69e4d8 @klacke ""
authored
56 include_dir = [],
f0341a3 @klacke ""
authored
57 yaws, %% server string
0c9da97 @klacke added ability to run as different user than root
authored
58 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
59 uid, %% unix uid of user that started yaws
60 id = "default" %% string identifying this instance of yaws
3dc56a7 @klacke javascript support in ehtml
authored
61 }).
62
21abc5b @klacke Initial revision
authored
63
64
661bd8c @klacke ""
authored
65 -record(ssl,
66 {
67 keyfile,
68 certfile,
69 verify = 0,
70 depth = 1,
71 password,
72 cacertfile,
73 ciphers,
74 cachetimeout}).
75
76
7fd4ad4 @klacke backwards incomp cahnge with flags in gc and sc instead of many bools, c...
authored
77 %% flags for sconfs
78 -define(SC_ACCESS_LOG, 1).
79 -define(SC_ADD_PORT, 2).
80 -define(SC_TILDE_EXPAND, 8).
81 -define(SC_DIR_LISTINGS, 16).
82 -define(SC_DEFLATE, 32).
83
84
85 -define(SC_DEF, ?SC_ACCESS_LOG bor ?SC_ADD_PORT).
86
87 -define(sc_has_access_log(SC),
88 ((SC#sconf.flags band ?SC_ACCESS_LOG) /= 0)).
89 -define(sc_has_add_port(SC),
90 ((SC#sconf.flags band ?SC_ADD_PORT) /= 0)).
91 -define(sc_has_tilde_expand(SC),
92 ((SC#sconf.flags band ?SC_TILDE_EXPAND) /= 0)).
93 -define(sc_has_dir_listings(SC),
94 ((SC#sconf.flags band ?SC_DIR_LISTINGS) /= 0)).
95 -define(sc_has_deflate(SC),
96 ((SC#sconf.flags band ?SC_DEFLATE) /= 0)).
97
3dc56a7 @klacke javascript support in ehtml
authored
98
7fd4ad4 @klacke backwards incomp cahnge with flags in gc and sc instead of many bools, c...
authored
99 -define(sc_set_access_log(SC, Bool),
100 SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_ACCESS_LOG, Bool)}).
101 -define(sc_set_add_port(SC, Bool),
102 SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_ADD_PORT, Bool)}).
103 -define(sc_set_ssl(SC, Bool),
104 SC#sconf{flags = yaws:flag(SC#sconf.flags , ?SC_SSL, Bool)}).
105 -define(sc_set_tilde_expand(SC, Bool),
106 SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_TILDE_EXPAND, Bool)}).
107 -define(sc_set_dir_listings(SC, Bool),
108 SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_DIR_LISTINGS, Bool)}).
109 -define(sc_set_deflate(SC, Bool),
110 SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_DEFLATE, Bool)}).
3dc56a7 @klacke javascript support in ehtml
authored
111
112
113
21abc5b @klacke Initial revision
authored
114 %% server conf
115 -record(sconf,
35208ae Fixed redirect_local
Johan Bevemyr authored
116 {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
117 flags = ?SC_DEF,
44a50e4 Added rhost option for setting explicit redirect host (and port if neede...
Johan Bevemyr authored
118 rhost, %% forced redirect host (+ optional port)
f48ee71 Fixed redirects and added rport and rmethod server settings.
Johan Bevemyr authored
119 rmethod, %% forced redirect method
0d6e5ea @klacke fixed tilde username expansion it didn't work, also made thta a configur...
authored
120 docroot, %% path to the docs
121 listen = {127,0,0,1}, %% bind to this IP, {0,0,0,0} is possible
122 servername = "localhost", %% servername is what Host: header is
123 ets, %% local store for this server
661bd8c @klacke ""
authored
124 ssl,
55c9af7 Changed implementation of multipart form data. There is a new config
Seah Hinde authored
125 authdirs = [],
0d6e5ea @klacke fixed tilde username expansion it didn't work, also made thta a configur...
authored
126 partial_post_size = nolimit,
127 appmods = [], %% list of modules for this app
7cb9a46 @klacke customized crash messages
authored
128 errormod_404 = yaws_404, %% the default 404 error module
129 errormod_crash = yaws_404, %% use the same module for crashes
c3386b0 @klacke added arg_rewrite_mod
authored
130 arg_rewrite_mod = yaws,
b0837d6 More opaque stuff.
Tobbe Tornquist authored
131 opaque = [], %% useful in embedded mode
f0f2614 @carsten3347 Made allowed script types (yaws, php, cgi) configurable.
carsten3347 authored
132 start_mod, %% user provided module to be started
8e69e2c @klacke first almost working vsn of revproxy
authored
133 allowed_scripts = [yaws],
c9cdfa9 @carsten3347 Made the php executable configurable
carsten3347 authored
134 phpexe = "php",
d7b3a5d @klacke backed off the is_default patch
authored
135 revproxy = []
21abc5b @klacke Initial revision
authored
136 }).
137
0d6e5ea @klacke fixed tilde username expansion it didn't work, also made thta a configur...
authored
138
0dd21d2 Added Basic Authentication support with a new subsection to the server c...
Seah Hinde authored
139 % Auth conf - from server conf and .yaws_auth
140 -record(auth,
55c9af7 Changed implementation of multipart form data. There is a new config
Seah Hinde authored
141 {dir = [],
142 realm = "",
143 type = "Basic",
144 users = []
145 }).
21abc5b @klacke Initial revision
authored
146
3dc56a7 @klacke javascript support in ehtml
authored
147
00303e2 @klacke outh record, the outgoing headers are built up into a record now, much c...
authored
148
149 %% this internal record is used and returned by the URL path parser
150
151 -record(urltype, {type, %% error | yaws | regular | directory |
152 %% forbidden | appmod
153 finfo,
154 path,
155 fullpath,
156 dir, %% relative dir where the path leads to
157 %% flat | unflat need flat for authentication
158 data, %% Binary | FileDescriptor | DirListing | undefined
dc15586 @carsten3347 Support for `Content-Encoding: deflate' using zlib.
carsten3347 authored
159 deflate, %% undefined | Binary | dynamic
00303e2 @klacke outh record, the outgoing headers are built up into a record now, much c...
authored
160 mime = "text/html", %% MIME type
6b289a9 @carsten3347 Added CGI and PHP support.
carsten3347 authored
161 pathinfo
00303e2 @klacke outh record, the outgoing headers are built up into a record now, much c...
authored
162 }).
163
164
165
166
167 %% this record is constructed as we build up
168 %% the outgoing headers
169
170 -record(outh, {
171 status, %% int status code
172
173 doclose, %% bool
174 chunked, %% bool
dc15586 @carsten3347 Support for `Content-Encoding: deflate' using zlib.
carsten3347 authored
175 encoding=identity,
176 %% identity, deflate
00303e2 @klacke outh record, the outgoing headers are built up into a record now, much c...
authored
177 contlen, %% integer
50d5504 @carsten3347 Log file size for dynamic pages.
carsten3347 authored
178 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
179
180
181 %% and the total set of out headers we can have
182 %% as actual strings
183 connection,
184 server,
185 location,
186 cache_control,
187 date,
188 allow,
189 last_modified,
190 etag,
191 set_cookie,
0a0a859 @carsten3347 For GETs on regular files:
carsten3347 authored
192 content_range,
00303e2 @klacke outh record, the outgoing headers are built up into a record now, much c...
authored
193 content_length,
194 content_type,
dc15586 @carsten3347 Support for `Content-Encoding: deflate' using zlib.
carsten3347 authored
195 content_encoding,
00303e2 @klacke outh record, the outgoing headers are built up into a record now, much c...
authored
196 transfer_encoding,
06a1bef @klacke ""
authored
197 www_authenticate,
198 other %% misc other headers
199 }).
00303e2 @klacke outh record, the outgoing headers are built up into a record now, much c...
authored
200
201
202
Something went wrong with that request. Please try again.