This file is indexed.

/usr/lib/yaws/include/yaws.hrl is in erlang-yaws 1.98-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
%%%----------------------------------------------------------------------
%%% File    : yaws.hrl
%%% Author  : Claes Wikstrom <klacke@hyber.org>
%%% Purpose :
%%% Created : 16 Jan 2002 by Claes Wikstrom <klacke@hyber.org>
%%%----------------------------------------------------------------------

-author('klacke@hyber.org').



%% flags for gconfs
-define(GC_TTY_TRACE,                        1).
-define(GC_DEBUG,                            2).
-define(GC_COPY_ERRLOG,                      4).
-define(GC_BACKWARDS_COMPAT_PARSE,           8).
-define(GC_LOG_RESOLVE_HOSTNAME,            16).
-define(GC_FAIL_ON_BIND_ERR,                32).
-define(GC_PICK_FIRST_VIRTHOST_ON_NOMATCH,  64).
-define(GC_USE_FDSRV,                      128).
-define(GC_USE_OLD_SSL,                    256).
-define(GC_USE_ERLANG_SENDFILE,            512).
-define(GC_USE_YAWS_SENDFILE,             1024).



-define(GC_DEF, ?GC_FAIL_ON_BIND_ERR).

-define(gc_has_tty_trace(GC),
        ((GC#gconf.flags band ?GC_TTY_TRACE) /= 0)).
-define(gc_has_debug(GC),
        ((GC#gconf.flags band ?GC_DEBUG) /= 0)).
-define(gc_has_copy_errlog(GC),
        ((GC#gconf.flags band ?GC_COPY_ERRLOG) /= 0)).
-define(gc_log_has_resolve_hostname(GC),
        ((GC#gconf.flags band ?GC_LOG_RESOLVE_HOSTNAME) /= 0)).
-define(gc_fail_on_bind_err(GC),
        ((GC#gconf.flags band ?GC_FAIL_ON_BIND_ERR) /= 0)).
-define(gc_pick_first_virthost_on_nomatch(GC),
        ((GC#gconf.flags band ?GC_PICK_FIRST_VIRTHOST_ON_NOMATCH) /= 0)).
-define(gc_use_old_ssl(GC),
        ((GC#gconf.flags band ?GC_USE_OLD_SSL) /= 0)).
-define(gc_use_erlang_sendfile(GC),
        ((GC#gconf.flags band ?GC_USE_ERLANG_SENDFILE) /= 0)).
-define(gc_use_yaws_sendfile(GC),
        ((GC#gconf.flags band ?GC_USE_YAWS_SENDFILE) /= 0)).

-define(gc_set_tty_trace(GC, Bool),
        GC#gconf{flags = yaws:flag(GC#gconf.flags,?GC_TTY_TRACE, Bool)}).
-define(gc_set_debug(GC, Bool),
        GC#gconf{flags = yaws:flag(GC#gconf.flags, ?GC_DEBUG, Bool)}).
-define(gc_set_copy_errlog(GC, Bool),
        GC#gconf{flags = yaws:flag(GC#gconf.flags, ?GC_COPY_ERRLOG, Bool)}).
-define(gc_log_set_resolve_hostname(GC, Bool),
        GC#gconf{flags = yaws:flag(GC#gconf.flags,
                                   ?GC_LOG_RESOLVE_HOSTNAME, Bool)}).
-define(gc_set_fail_on_bind_err(GC, Bool),
        GC#gconf{flags = yaws:flag(GC#gconf.flags,?GC_FAIL_ON_BIND_ERR,Bool)}).
-define(gc_set_pick_first_virthost_on_nomatch(GC, Bool),
        GC#gconf{flags = yaws:flag(GC#gconf.flags,
                                   ?GC_PICK_FIRST_VIRTHOST_ON_NOMATCH,Bool)}).
-define(gc_set_use_old_ssl(GC, Bool),
        GC#gconf{flags = yaws:flag(GC#gconf.flags,?GC_USE_OLD_SSL,Bool)}).
-define(gc_set_use_erlang_sendfile(GC, Bool),
        GC#gconf{flags = yaws:flag(GC#gconf.flags,?GC_USE_ERLANG_SENDFILE,Bool)}).
-define(gc_set_use_yaws_sendfile(GC, Bool),
        GC#gconf{flags = yaws:flag(GC#gconf.flags,?GC_USE_YAWS_SENDFILE,Bool)}).


%% global conf
-record(gconf,{
          yaws_dir,                       % topdir of Yaws installation
          trace,                          % false | {true,http} | {true,traffic}
          flags = ?GC_DEF,                % boolean flags
          logdir,
          ebin_dir = [],
          src_dir  = [],
          runmods  = [],                  % runmods for entire server
          keepalive_timeout    = 30000,
          keepalive_maxuses    = nolimit, % nolimit or non negative integer
          max_num_cached_files = 400,
          max_num_cached_bytes = 1000000, % 1 MEG
          max_size_cached_file = 8000,
          max_connections      = nolimit, % max number of TCP connections

          %% Override default connection handler processes spawn options for
          %% performance/memory tuning.
          %% [] | [{fullsweep_after,Number}, {min_heap_size, Size}]
          %% other options such as monitor, link are ignored.
          process_options = [],

          large_file_chunk_size = 10240,
          mnesia_dir            = [],
          log_wrap_size         = 10000000, % wrap logs after 10M
          cache_refresh_secs    = 30,       % seconds  (auto zero when debug)
          include_dir           = [],       % list of inc dirs for .yaws files
          phpexe = "/usr/bin/php-cgi",      % cgi capable php executable

          yaws,                % server string
          id = "default",      % string identifying this instance of yaws

          enable_soap = false, % start yaws_soap_srv iff true

          %% a list of
          %% {{Mod, Func}, WsdlFile, Prefix} | {{Mod, Func}, WsdlFile}
          %% automatically setup in yaws_soap_srv init.
          soap_srv_mods = [],

          ysession_mod = yaws_session_server, % storage module for ysession
          acceptor_pool_size = 8,             % size of acceptor proc pool

          mime_types_info                     % undefined | #mime_types_info{}
         }).

-record(ssl, {
          keyfile,
          certfile,
          verify = 0,
          fail_if_no_peer_cert,
          depth = 1,
          password,
          cacertfile,
          ciphers,
          cachetimeout
         }).


%% flags for sconfs
-define(SC_ACCESS_LOG,             1).
-define(SC_AUTH_LOG,               2).
-define(SC_ADD_PORT,               4).
-define(SC_STATISTICS,             8).
-define(SC_TILDE_EXPAND,          16).
-define(SC_DIR_LISTINGS,          32).
-define(SC_DEFLATE,               64).
-define(SC_DIR_ALL_ZIP,          128).
-define(SC_DAV,                  512).
-define(SC_FCGI_TRACE_PROTOCOL, 1024).
-define(SC_FCGI_LOG_APP_ERROR,  2048).
-define(SC_FORWARD_PROXY,       4096).
-define(SC_AUTH_SKIP_DOCROOT,   8192).



-define(SC_DEF, ?SC_ACCESS_LOG bor ?SC_ADD_PORT bor ?SC_AUTH_LOG).

-define(sc_has_access_log(SC),
        (((SC)#sconf.flags band ?SC_ACCESS_LOG) /= 0)).
-define(sc_has_auth_log(SC),
        (((SC)#sconf.flags band ?SC_AUTH_LOG) /= 0)).
-define(sc_has_add_port(SC),
        (((SC)#sconf.flags band ?SC_ADD_PORT) /= 0)).
-define(sc_has_statistics(SC),
        (((SC)#sconf.flags band ?SC_STATISTICS) /= 0)).
-define(sc_has_tilde_expand(SC),
        (((SC)#sconf.flags band ?SC_TILDE_EXPAND) /= 0)).
-define(sc_has_dir_listings(SC),
        (((SC)#sconf.flags band ?SC_DIR_LISTINGS) /= 0)).
-define(sc_has_deflate(SC),
        (((SC)#sconf.flags band ?SC_DEFLATE) /= 0)).
-define(sc_has_dir_all_zip(SC),
        (((SC)#sconf.flags band ?SC_DIR_ALL_ZIP) /= 0)).
-define(sc_has_dav(SC),
        (((SC)#sconf.flags band ?SC_DAV) /= 0)).
-define(sc_fcgi_trace_protocol(SC),
        (((SC)#sconf.flags band ?SC_FCGI_TRACE_PROTOCOL) /= 0)).
-define(sc_fcgi_log_app_error(SC),
        (((SC)#sconf.flags band ?SC_FCGI_LOG_APP_ERROR) /= 0)).
-define(sc_forward_proxy(SC),
        (((SC)#sconf.flags band ?SC_FORWARD_PROXY) /= 0)).
-define(sc_auth_skip_docroot(SC),
        (((SC)#sconf.flags band ?SC_AUTH_SKIP_DOCROOT) /= 0)).


-define(sc_set_access_log(SC, Bool),
        SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_ACCESS_LOG, Bool)}).
-define(sc_set_auth_log(SC, Bool),
        SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_AUTH_LOG, Bool)}).
-define(sc_set_add_port(SC, Bool),
        SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_ADD_PORT, Bool)}).
-define(sc_set_statistics(SC, Bool),
        SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_STATISTICS, Bool)}).
-define(sc_set_tilde_expand(SC, Bool),
        SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_TILDE_EXPAND, Bool)}).
-define(sc_set_dir_listings(SC, Bool),
        SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_DIR_LISTINGS, Bool)}).
-define(sc_set_deflate(SC, Bool),
        SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_DEFLATE, Bool)}).
-define(sc_set_dir_all_zip(SC, Bool),
        SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_DIR_ALL_ZIP, Bool)}).
-define(sc_set_dav(SC, Bool),
        SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_DAV, Bool)}).
-define(sc_set_fcgi_trace_protocol(SC, Bool),
        SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_FCGI_TRACE_PROTOCOL,
                                   Bool)}).
-define(sc_set_fcgi_log_app_error(SC, Bool),
        SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_FCGI_LOG_APP_ERROR,
                                   Bool)}).
-define(sc_set_forward_proxy(SC, Bool),
        SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_FORWARD_PROXY, Bool)}).
-define(sc_set_auth_skip_docroot(SC, Bool),
        SC#sconf{flags = yaws:flag(SC#sconf.flags,?SC_AUTH_SKIP_DOCROOT,Bool)}).


%% server conf
%% we cannot compare sconfs directly due to the ets field in #sconf{} use
%% yaws_config:eq_sconfs/2
-record(sconf, {
          port = 8000,                  % which port is this server listening to
          flags = ?SC_DEF,
          redirect_map=[],              % a list of
                                        % {Prefix, #url{}, append|noappend}
                                        % #url{} can be partially populated

          rhost,                        % forced redirect host (+ optional port)
          rmethod,                      % forced redirect method
          docroot,                      % path to the docs
          xtra_docroots = [],           % if we have additional pseudo docroots
          listen = [{127,0,0,1}],       % bind to this IP, {0,0,0,0} is possible
          servername = "localhost",     % servername is what Host: header is
          serveralias = [],             % Alternate names for this vhost
          yaws,                         % server string for this vhost
          ets,                          % local store for this server
          ssl,                          % undefined | #ssl{}
          authdirs = [],                % [{docroot, [#auth{}]}]
          partial_post_size = 10240,

          %% An item in the appmods list  can be either of the
          %% following, this is all due to backwards compat issues.
          %% 1.  an atom - this is the equivalent to {atom, atom}
          %% 2 . A two tuple {Path, Mod}
          %% 3 A three tuple {Path, Mod, [ExcludeDir ....]}
          appmods = [],

          expires = [],
          errormod_401 = yaws_outmod,   % the default 401 error module
          errormod_404 = yaws_outmod,   % the default 404 error module
          errormod_crash = yaws_outmod, % use the same module for crashes
          arg_rewrite_mod = yaws,
          logger_mod = yaws_log,        % access/auth logging module
          opaque = [],                  % useful in embedded mode
          start_mod,                    % user provided module to be started
          allowed_scripts = [yaws,php,cgi,fcgi],
          tilde_allowed_scripts = [],
          index_files = ["index.yaws", "index.html", "index.php"],
          revproxy = [],
          soptions = [{listen_opts, [{backlog, 1024}, {recbuf, 8192}]}],
          extra_cgi_vars = [],
          stats,                        % raw traffic statistics
          fcgi_app_server,              % FastCGI application server {host,port}
          php_handler = {cgi, "/usr/bin/php-cgi"},
          shaper,
          deflate_options,              % undefined | #deflate{}
          mime_types_info,              % undefined | #mime_types_info{}
                                        % if undefined, global config is used
          dispatch_mod                  % custom dispatch module
         }).


%% Auth conf - from server conf and .yaws_auth
-record(auth, {
          dir     = [],
          docroot = [],
          files   = [],
          realm   = "",
          type    = "Basic",
          headers = [],    % headers to send on 401
          users   = [],    % list of {User, Password} tuples
          acl     = none,  % list of allowed/denies IPs or none
          mod     = [],    % authentication module callback
          outmod  = [],    % module to handles 401 unauthorized messages
          pam     = false  % should we use pam to auth a user
         }).


%% Macro used to list default compressible mime-types
-define(DEFAULT_COMPRESSIBLE_MIME_TYPES, [
                                          {"text", all},
                                          {"application", "rtf"},
                                          {"application", "msword"},
                                          {"application", "postscript"},
                                          {"application", "pdf"},
                                          {"application", "x-dvi"},
                                          {"application", "javascript"},
                                          {"application", "x-javascript"}
                                         ]).

%% Internal record used to initialize a zlib stream for compression
-record(deflate, {
          min_compress_size = nolimit, % nolimit or non negative integer
                                       % (in bytes)
          compression_level = default, % none | default | best_compression |
                                       % best_speed | 0..9
          window_size       = -15,     % -15..-9
          mem_level         = 8,       % 1..9
          strategy          = default, % default | filtered | huffman_only
          use_gzip_static   = false,

          %% [{Type, undefined|SubType}] | all
          mime_types = ?DEFAULT_COMPRESSIBLE_MIME_TYPES
         }).


%% Internal record used to set information about mime-types
-record(mime_types_info, {
          mime_types_file, % an absolute filename path
          types    = [],   % a map between mime-types and extensions
          charsets = [],   % a map between charsets and extensions
          default_type = "text/plain",
          default_charset
         }).


%% this internal record is used and returned by the URL path parser
-record(urltype, {
          type,          % error | yaws | regular | directory | forbidden |
                         % appmod
          finfo,
          path     = [],
          fullpath = [], % deep list (WHY?)
          dir      = [], % relative dir where the path leads to
                         % flat | unflat need flat for authentication
          data,          % type-specific
                         % e.g: Binary | FileDescriptor | DirListing | undefined
          deflate,       % undefined | Binary | dynamic
          mime = "text/html",
          getpath,       % as GET'ed by client
          pathinfo
         }).




%% this record is constructed as we build up the outgoing headers
-record(outh, {
          status,              % int status code

          doclose,             % bool
          chunked,             % bool
          exceedmaxuses=false, % bool, true if hit keep-alive max uses
          encoding=decide,     % decide, identity, deflate
          contlen,             % integer
          act_contlen,         % actual content length for dynamic pages
                               % and the total set of out headers we can have as
                               % actual strings
          connection,
          server,
          location,
          cache_control,
          expires,
          date,
          allow,
          last_modified,
          etag,
          set_cookie,
          content_range,
          content_length,
          content_type,
          content_encoding,
          transfer_encoding,
          www_authenticate,
          vary,
          other                % misc other headers
         }).


%% forward and reverse proxy config info
-record(proxy_cfg, {
          prefix,
          url,
          intercept_mod
         }).


%% as read by application:get_env()
-record(env, {
          debug,
          trace,
          traceoutput,
          conf,
          runmod,
          embedded,
          id
         }).

%% Typically used in error printouts as in:
%% error_logger:format("Err ~p at ~p~n", [Reason, ?stack()])
-define(stack(), try throw(1) catch _:_ -> erlang:get_stacktrace() end).


%%% The following is for emacs, do not remove
%%% Local Variables:
%%% comment-column: 36
%%% End: