fuzed 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ -module(test_rails_handler).
2
+ -author('klacke@bluetail.com').
3
+ -include("../yaws_includes/yaws_api.hrl").
4
+ -compile(export_all).
5
+
6
+
7
+ out404(A, _GC, SC) ->
8
+ Resource = rails_connection_pool:get(),
9
+ Result = rails_forwarder:handle_request(Resource, A,SC, 5000),
10
+ rails_connection_pool:refund(Resource),
11
+ Result.
Binary file
@@ -0,0 +1,26 @@
1
+ -module(join_cluster).
2
+ -compile(export_all).
3
+
4
+ start(Server, Command) ->
5
+ code:add_patha("./elibs"),
6
+ erlang:set_cookie(node(), 'AWZVAQXUPGVPKZQLYEUP'),
7
+ net_adm:ping(Server), sleep_in_HEAVENLY_PEACE(2),
8
+ start_resource_manager(Command, 4).
9
+
10
+ start_resource_manager(Command, N) ->
11
+ Spawner = fun() ->
12
+ Responder = port_wrapper:wrap(Command),
13
+ rails_connection_pool:add({node(), Responder}),
14
+ Responder
15
+ end,
16
+ Slayer = fun(Responder) ->
17
+ Responder ! shutdown,
18
+ rails_connection_pool:remove({node(), Responder})
19
+ end,
20
+ resource_manager:start(Spawner,Slayer,N).
21
+
22
+ sleep_in_HEAVENLY_PEACE(Secs) ->
23
+ receive
24
+ after Secs * 1000 ->
25
+ Secs * 1000
26
+ end.
@@ -0,0 +1,13 @@
1
+ $:.unshift File.dirname(__FILE__)
2
+
3
+ module Fuzed
4
+ VERSION = '0.1.0'
5
+
6
+ def self.root
7
+ File.expand_path(File.join(File.dirname(__FILE__), *%w[..]))
8
+ end
9
+
10
+ def self.relative(path)
11
+ File.join(self.root, path)
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ load File.join(File.dirname(__FILE__), *%w[helloworld script rack.rb])
@@ -0,0 +1,38 @@
1
+ # conf for yaws
2
+
3
+ logdir = /usr/local/var/log/yaws
4
+
5
+ ebin_dir = /usr/local/lib/yaws/examples/ebin
6
+
7
+ include_dir = /usr/local/lib/yaws/examples/include
8
+
9
+ trace = false
10
+
11
+ copy_error_log = true
12
+
13
+ log_wrap_size = 1000000
14
+
15
+ log_resolve_hostname = false
16
+
17
+ fail_on_bind_err = true
18
+
19
+ auth_log = true
20
+
21
+ pick_first_virthost_on_nomatch = true
22
+
23
+ use_fdsrv = false
24
+
25
+ <server testing>
26
+ port = 8002
27
+ listen = 0.0.0.0
28
+ docroot = /Users/tom/dev/git/fuzed/helloworld/public
29
+ errormod_404 = test_rails_handler
30
+ </server>
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
@@ -0,0 +1,6 @@
1
+ #!/bin/sh
2
+
3
+ echo "Starting a client named $1 offering service to $2"
4
+ echo "Each node will run: '$3'"
5
+ erl -noshell -name $1 -eval "join_cluster:start('$2',\"$3\")."
6
+ #echo "join_cluster:start($2,\"$3\")"
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+
3
+ # Invoke with an argument which is the nodename
4
+ echo "Starting yaws server with name: $@"
5
+ yaws --conf testing.conf --pa elibs -name "$@" --runmod rails_connection_pool
@@ -0,0 +1,38 @@
1
+ # conf for yaws
2
+
3
+ logdir = /usr/local/var/log/yaws
4
+
5
+ ebin_dir = /usr/local/lib/yaws/examples/ebin
6
+
7
+ include_dir = /usr/local/lib/yaws/examples/include
8
+
9
+ trace = false
10
+
11
+ copy_error_log = true
12
+
13
+ log_wrap_size = 1000000
14
+
15
+ log_resolve_hostname = false
16
+
17
+ fail_on_bind_err = true
18
+
19
+ auth_log = true
20
+
21
+ pick_first_virthost_on_nomatch = true
22
+
23
+ use_fdsrv = false
24
+
25
+ <server testing>
26
+ port = {{ PORT }}
27
+ listen = 0.0.0.0
28
+ docroot = {{ RAILS_PUBLIC_DIR }}
29
+ errormod_404 = test_rails_handler
30
+ </server>
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
@@ -0,0 +1,177 @@
1
+
2
+ # conf for yaws
3
+
4
+
5
+ # first we have a set of globals
6
+ # That apply to all virtual servers
7
+
8
+
9
+ # This is the directory where all logfiles for
10
+ # all virtual servers will be written
11
+
12
+ logdir = /usr/local/var/log/yaws
13
+
14
+ # This the path to a directory where additional
15
+ # beam code can be placed. The daemon will add this
16
+ # directory to its search path
17
+
18
+ ebin_dir = /usr/local/lib/yaws/examples/ebin
19
+
20
+
21
+ # This is a directory where application specific .hrl
22
+ # files can be placed. application specifig .yaws code can
23
+ # then include these .hrl files
24
+
25
+ include_dir = /usr/local/lib/yaws/examples/include
26
+
27
+
28
+
29
+
30
+
31
+ # This is a debug variable, possible values are http | traffic | false
32
+ # It is also possible to set the trace (possibly to the tty) while
33
+ # invoking yaws from the shell as in
34
+ # yaws -i -T -x (see man yaws)
35
+
36
+ trace = false
37
+
38
+
39
+
40
+
41
+
42
+ # it is possible to have yaws start additional
43
+ # application specific code at startup
44
+ #
45
+ # runmod = mymodule
46
+
47
+
48
+ # By default yaws will copy the erlang error_log and
49
+ # end write it to a wrap log called report.log (in the logdir)
50
+ # this feature can be turned off. This would typically
51
+ # be the case when yaws runs within another larger app
52
+
53
+ copy_error_log = true
54
+
55
+
56
+ # Logs are wrap logs
57
+
58
+ log_wrap_size = 1000000
59
+
60
+
61
+ # Possibly resolve all hostnames in logfiles so webalizer
62
+ # can produce the nice geography piechart
63
+
64
+ log_resolve_hostname = false
65
+
66
+
67
+
68
+ # fail completely or not if yaws fails
69
+ # to bind a listen socket
70
+ fail_on_bind_err = true
71
+
72
+
73
+
74
+ # If yaws is started as root, it can, once it has opened
75
+ # all relevant sockets for listening, change the uid to a
76
+ # user with lower accessrights than root
77
+
78
+ # username = nobody
79
+
80
+
81
+ # If HTTP auth is used, it is possible to have a specific
82
+ # auth log.
83
+
84
+ auth_log = true
85
+
86
+
87
+ # When we're running multiple yaws systems on the same
88
+ # host, we need to give each yaws system an individual
89
+ # name. Yaws will write a number of runtime files under
90
+ # /tmp/yaws/${id}
91
+ # The default value is "default"
92
+
93
+
94
+ # id = myname
95
+
96
+
97
+ # earlier versions of Yaws picked the first virtual host
98
+ # in a list of hosts with the same IP/PORT when the Host:
99
+ # header doesn't match any name on any Host
100
+ # This is often nice in testing environments but not
101
+ # acceptable in real live hosting scenarios
102
+
103
+ pick_first_virthost_on_nomatch = true
104
+
105
+
106
+ # All unices are broken since it's not possible to bind to
107
+ # a privileged port (< 1024) unless uid==0
108
+ # There is a contrib in jungerl which makes it possible by means
109
+ # of an external setuid root programm called fdsrv to listen to
110
+ # to privileged port.
111
+ # If we use this feature, it requires fdsrv to be properly installed.
112
+ # Doesn't yet work with SSL.
113
+
114
+ use_fdsrv = false
115
+
116
+
117
+
118
+
119
+ # end then a set of virtual servers
120
+ # First two virthosted servers on the same IP (0.0.0.0)
121
+ # in this case, but an explicit IP can be given as well
122
+
123
+ #<server sean.desk.hq.powerset.com>
124
+ # port = 80
125
+ # listen = 0.0.0.0
126
+ # docroot = /usr/local/var/yaws/www
127
+ #</server>
128
+
129
+ #<server localhost>
130
+ # port = 80
131
+ # listen = 0.0.0.0
132
+ # docroot = /tmp
133
+ # dir_listings = true
134
+ # dav = true
135
+ # <auth>
136
+ # realm = foobar
137
+ # dir = /
138
+ # user = foo:bar
139
+ # user = baz:bar
140
+ # </auth>
141
+ #</server>
142
+
143
+ <server debug>
144
+ port = 8001
145
+ listen = 0.0.0.0
146
+ docroot = /Users/tom/dev/git/fuzed/helloworld/public
147
+ appmods = <pathelem, myappmod>
148
+ errormod_404 = myappmod
149
+ </server>
150
+
151
+ <server testing>
152
+ port = 8002
153
+ listen = 0.0.0.0
154
+ docroot = /Users/tom/dev/git/fuzed/helloworld/public
155
+ errormod_404 = test_rails_handler
156
+ </server>
157
+
158
+ # And then an ssl server
159
+ #
160
+ #<server sean.desk.hq.powerset.com>
161
+ # port = 443
162
+ # docroot = /tmp
163
+ # listen = 0.0.0.0
164
+ # dir_listings = true
165
+ # <ssl>
166
+ # keyfile = /usr/local/etc/yaws-key.pem
167
+ # certfile = /usr/local/etc/yaws-cert.pem
168
+ # </ssl>
169
+ #</server>
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
@@ -0,0 +1,28 @@
1
+ %%% ====================================================================
2
+ %%% Header file for erlsom
3
+ %%%
4
+ %%% Copyright (C) 2006 Willem de Jong
5
+ %%%
6
+ %%% This program is free software; you can redistribute it and/or modify
7
+ %%% it under the terms of the GNU General Public License as published by
8
+ %%% the Free Software Foundation; either version 2 of the License, or
9
+ %%% (at your option) any later version.
10
+ %%%
11
+ %%% This program is distributed in the hope that it will be useful, but
12
+ %%% WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ %%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ %%% General Public License for more details.
15
+ %%%
16
+ %%% You should have received a copy of the GNU General Public License
17
+ %%% along with this program; if not, write to the Free Software
18
+ %%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19
+ %%% USA
20
+ %%%
21
+ %%% Author contact: w.a.de.jong@gmail.com
22
+ %%% ====================================================================
23
+
24
+ %%% version: 0.0.2
25
+
26
+ %% prefix=the prefix that will be used in the result
27
+ -record(ns, {uri, prefix}).
28
+ -record(qname, {uri, localPart, prefix, mappedPrefix}).
@@ -0,0 +1,48 @@
1
+ -record(wsdl, {operations, model, module}).
2
+ -record(port, {service, port, binding, address}).
3
+ -record(operation, {service, port, operation, binding, address, action}).
4
+ -record('soap:detail', {anyAttribs, choice}).
5
+ -record('soap:Fault', {anyAttribs, 'faultcode', 'faultstring', 'faultactor', 'detail'}).
6
+ -record('soap:Body', {anyAttribs, choice}).
7
+ -record('soap:Header', {anyAttribs, choice}).
8
+ -record('soap:Envelope', {anyAttribs, 'Header', 'Body', choice}).
9
+ -record('wsdl:tExtensibilityElement', {anyAttribs, 'wsdl:required'}).
10
+ -record('wsdl:tPort', {anyAttribs, 'name', 'binding', 'documentation', choice}).
11
+ -record('wsdl:tService', {anyAttribs, 'name', 'documentation', choice, 'port'}).
12
+ -record('wsdl:tBindingOperation', {anyAttribs, 'name', 'documentation', choice, 'input', 'output', 'fault'}).
13
+ -record('wsdl:tBindingOperationFault', {anyAttribs, 'name', 'documentation', choice}).
14
+ -record('wsdl:tBindingOperationMessage', {anyAttribs, 'name', 'documentation', choice}).
15
+ -record('wsdl:tBinding', {anyAttribs, 'name', 'type', 'documentation', choice, 'operation'}).
16
+ -record('wsdl:tFault', {anyAttribs, 'name', 'message', 'documentation'}).
17
+ -record('wsdl:tParam', {anyAttribs, 'name', 'message', 'documentation'}).
18
+ -record('wsdl:solicit-response-or-notification-operation', {anyAttribs, 'output', 'solicit-response-or-notification-operation/SEQ2'}).
19
+ -record('wsdl:solicit-response-or-notification-operation/SEQ2', {anyAttribs, 'input', 'fault'}).
20
+ -record('wsdl:request-response-or-one-way-operation', {anyAttribs, 'input', 'request-response-or-one-way-operation/SEQ1'}).
21
+ -record('wsdl:request-response-or-one-way-operation/SEQ1', {anyAttribs, 'output', 'fault'}).
22
+ -record('wsdl:tOperation', {anyAttribs, 'name', 'parameterOrder', 'documentation', any, choice}).
23
+ -record('wsdl:tPortType', {anyAttribs, 'name', 'documentation', 'operation'}).
24
+ -record('wsdl:tPart', {anyAttribs, 'name', 'element', 'type', 'documentation'}).
25
+ -record('wsdl:tMessage', {anyAttribs, 'name', 'documentation', choice, 'part'}).
26
+ -record('wsdl:tTypes', {anyAttribs, 'documentation', choice}).
27
+ -record('wsdl:tImport', {anyAttribs, 'namespace', 'location', 'documentation'}).
28
+ -record('wsdl:tDefinitions', {anyAttribs, 'targetNamespace', 'name', 'documentation', any, choice}).
29
+ -record('wsdl:anyTopLevelOptionalElement-service', {anyAttribs, 'service'}).
30
+ -record('wsdl:anyTopLevelOptionalElement-binding', {anyAttribs, 'binding'}).
31
+ -record('wsdl:anyTopLevelOptionalElement-portType', {anyAttribs, 'portType'}).
32
+ -record('wsdl:anyTopLevelOptionalElement-message', {anyAttribs, 'message'}).
33
+ -record('wsdl:anyTopLevelOptionalElement-types', {anyAttribs, 'types'}).
34
+ -record('wsdl:anyTopLevelOptionalElement-import', {anyAttribs, 'import'}).
35
+ -record('wsdl:anyTopLevelOptionalElement', {anyAttribs, choice}).
36
+ -record('wsdl:tExtensibleDocumented', {anyAttribs, 'documentation', choice}).
37
+ -record('wsdl:tExtensibleAttributesDocumented', {anyAttribs, 'documentation'}).
38
+ -record('wsdl:tDocumented', {anyAttribs, 'documentation'}).
39
+ -record('wsdl:tDocumentation-any', {anyAttribs, choice}).
40
+ -record('wsdl:tDocumentation', {anyAttribs, choice}).
41
+ -record('soap:tBinding', {anyAttribs, 'wsdl:required', 'transport', 'style'}).
42
+ -record('soap:tOperation', {anyAttribs, 'wsdl:required', 'soapAction', 'style'}).
43
+ -record('soap:tBody', {anyAttribs, 'wsdl:required', 'parts', 'namespace', 'use', 'encodingStyle'}).
44
+ -record('soap:tFaultRes', {anyAttribs, 'wsdl:required', 'parts', 'namespace', 'use', 'encodingStyle'}).
45
+ -record('soap:tFault', {anyAttribs, 'wsdl:required', 'parts', 'namespace', 'use', 'encodingStyle', 'name'}).
46
+ -record('soap:tHeader', {anyAttribs, 'wsdl:required', 'namespace', 'encodingStyle', 'use', 'part', 'message', 'headerfault'}).
47
+ -record('soap:tHeaderFault', {anyAttribs, 'namespace', 'encodingStyle', 'use', 'part', 'message'}).
48
+ -record('soap:tAddress', {anyAttribs, 'wsdl:required', 'location'}).
@@ -0,0 +1,271 @@
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').
9
+
10
+
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
+ -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
+ -define(GC_USE_FDSRV, 256).
22
+ -define(GC_USE_LARGE_SSL_POOL, 512).
23
+
24
+ -define(GC_DEF, (?GC_AUTH_LOG bor ?GC_FAIL_ON_BIND_ERR)).
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)).
34
+ -define(gc_has_backwards_compat_parse(GC),
35
+ ((GC#gconf.flags band ?GC_BACKWARDS_COMPAT_PARSE) /= 0)).
36
+ -define(gc_log_has_resolve_hostname(GC),
37
+ ((GC#gconf.flags band ?GC_LOG_RESOLVE_HOSTNAME) /= 0)).
38
+ -define(gc_fail_on_bind_err(GC),
39
+ ((GC#gconf.flags band ?GC_FAIL_ON_BIND_ERR) /= 0)).
40
+ -define(gc_pick_first_virthost_on_nomatch(GC),
41
+ ((GC#gconf.flags band ?GC_PICK_FIRST_VIRTHOST_ON_NOMATCH) /= 0)).
42
+ -define(gc_use_fdsrv(GC),
43
+ ((GC#gconf.flags band ?GC_USE_FDSRV) /= 0)).
44
+ -define(gc_use_large_ssl_pool(GC),
45
+ ((GC#gconf.flags band ?GC_USE_LARGE_SSL_POOL) /= 0)).
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)}).
55
+ -define(gc_set_backwards_compat_parse(GC, Bool),
56
+ GC#gconf{flags = yaws:flag(GC#gconf.flags,
57
+ ?GC_BACKWARDS_COMPAT_PARSE, Bool)}).
58
+ -define(gc_log_set_resolve_hostname(GC, Bool),
59
+ GC#gconf{flags = yaws:flag(GC#gconf.flags,
60
+ ?GC_LOG_RESOLVE_HOSTNAME, Bool)}).
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)}).
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)}).
66
+ -define(gc_set_use_fdsrv(GC, Bool),
67
+ GC#gconf{flags = yaws:flag(GC#gconf.flags,?GC_USE_FDSRV,Bool)}).
68
+
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
+
72
+ %% global conf
73
+ -record(gconf,{yaws_dir, %% topdir of Yaws installation
74
+ trace, %% false | {true,http}|{true,traffic}
75
+ flags = ?GC_DEF, %% boolean flags
76
+ logdir,
77
+ ebin_dir = [],
78
+ runmods = [], %% runmods for entire server
79
+ keepalive_timeout = 15000,
80
+ max_num_cached_files = 400,
81
+ max_num_cached_bytes = 1000000, %% 1 MEG
82
+ max_size_cached_file = 8000,
83
+ large_file_chunk_size = 10240,
84
+ log_wrap_size = 10000000, % wrap logs after 10M
85
+ cache_refresh_secs = 30, % seconds (auto zero when debug)
86
+ include_dir = [], %% list of inc dirs for .yaws files
87
+ phpexe = "php-cgi", %% cgi capable php executable
88
+ yaws, %% server string
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,
93
+ enable_soap = false %% start yaws_soap_srv iff true
94
+ }).
95
+
96
+
97
+
98
+ -record(ssl,
99
+ {
100
+ keyfile,
101
+ certfile,
102
+ verify = 0,
103
+ depth = 1,
104
+ password,
105
+ cacertfile,
106
+ ciphers,
107
+ cachetimeout}).
108
+
109
+
110
+ %% flags for sconfs
111
+ -define(SC_ACCESS_LOG, 1).
112
+ -define(SC_ADD_PORT, 2).
113
+ -define(SC_TILDE_EXPAND, 8).
114
+ -define(SC_DIR_LISTINGS, 16).
115
+ -define(SC_DEFLATE, 32).
116
+ -define(SC_DIR_ALL_ZIP, 64).
117
+ -define(SC_DAV, 128).
118
+
119
+ -define(SC_DEF, ?SC_ACCESS_LOG bor ?SC_ADD_PORT).
120
+
121
+ -define(sc_has_access_log(SC),
122
+ (((SC)#sconf.flags band ?SC_ACCESS_LOG) /= 0)).
123
+ -define(sc_has_add_port(SC),
124
+ (((SC)#sconf.flags band ?SC_ADD_PORT) /= 0)).
125
+ -define(sc_has_tilde_expand(SC),
126
+ (((SC)#sconf.flags band ?SC_TILDE_EXPAND) /= 0)).
127
+ -define(sc_has_dir_listings(SC),
128
+ (((SC)#sconf.flags band ?SC_DIR_LISTINGS) /= 0)).
129
+ -define(sc_has_deflate(SC),
130
+ (((SC)#sconf.flags band ?SC_DEFLATE) /= 0)).
131
+ -define(sc_has_dir_all_zip(SC),
132
+ (((SC)#sconf.flags band ?SC_DIR_ALL_ZIP) /= 0)).
133
+ -define(sc_has_dav(SC),
134
+ (((SC)#sconf.flags band ?SC_DAV) /= 0)).
135
+
136
+
137
+ -define(sc_set_access_log(SC, Bool),
138
+ SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_ACCESS_LOG, Bool)}).
139
+ -define(sc_set_add_port(SC, Bool),
140
+ SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_ADD_PORT, Bool)}).
141
+ -define(sc_set_ssl(SC, Bool),
142
+ SC#sconf{flags = yaws:flag(SC#sconf.flags , ?SC_SSL, Bool)}).
143
+ -define(sc_set_tilde_expand(SC, Bool),
144
+ SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_TILDE_EXPAND, Bool)}).
145
+ -define(sc_set_dir_listings(SC, Bool),
146
+ SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_DIR_LISTINGS, Bool)}).
147
+ -define(sc_set_deflate(SC, Bool),
148
+ SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_DEFLATE, Bool)}).
149
+ -define(sc_set_dir_all_zip(SC, Bool),
150
+ SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_DIR_ALL_ZIP, Bool)}).
151
+ -define(sc_set_dav(SC, Bool),
152
+ SC#sconf{flags = yaws:flag(SC#sconf.flags, ?SC_DAV, Bool)}).
153
+
154
+
155
+
156
+ %% server conf
157
+ -record(sconf,
158
+ {port = 8000, %% which port is this server listening to
159
+ flags = ?SC_DEF,
160
+ redirect_map=[], %% redirect all requests to HostPort
161
+ rhost, %% forced redirect host (+ optional port)
162
+ rmethod, %% forced redirect method
163
+ docroot, %% path to the docs
164
+ xtra_docroots = [], %% if we have additional pseudo docroots
165
+ listen = {127,0,0,1}, %% bind to this IP, {0,0,0,0} is possible
166
+ servername = "localhost", %% servername is what Host: header is
167
+ ets, %% local store for this server
168
+ ssl,
169
+ authdirs = [],
170
+ partial_post_size = nolimit,
171
+ appmods = [], %% list of modules for this app
172
+ errormod_404 = yaws_404, %% the default 404 error module
173
+ errormod_crash = yaws_404, %% use the same module for crashes
174
+ arg_rewrite_mod = yaws,
175
+ opaque = [], %% useful in embedded mode
176
+ start_mod, %% user provided module to be started
177
+ allowed_scripts = [yaws],
178
+ revproxy = []
179
+ }).
180
+
181
+ %% we cannot compare sconfs directly due to the ets
182
+ %% field in #sconf{} use yaws_config:eq_sconfs/2
183
+
184
+
185
+ % Auth conf - from server conf and .yaws_auth
186
+ -record(auth,
187
+ {dir = [],
188
+ realm = "",
189
+ type = "Basic",
190
+ users = [],
191
+ mod = [], %% authentication module callback
192
+ pam = false %% should we use pam to auth a user
193
+ }).
194
+
195
+
196
+
197
+ %% this internal record is used and returned by the URL path parser
198
+
199
+ -record(urltype, {type, %% error | yaws | regular | directory |
200
+ %% forbidden | appmod
201
+ finfo,
202
+ path = [],
203
+ fullpath = [], %% deep list
204
+ dir = [], %% relative dir where the path leads to
205
+ %% flat | unflat need flat for authentication
206
+ data, %% Binary | FileDescriptor | DirListing | undefined
207
+ deflate, %% undefined | Binary | dynamic
208
+ mime = "text/html", %% MIME type
209
+ getpath, %% as GET'ed by client
210
+ pathinfo
211
+ }).
212
+
213
+
214
+
215
+
216
+ %% this record is constructed as we build up
217
+ %% the outgoing headers
218
+
219
+ -record(outh, {
220
+ status, %% int status code
221
+
222
+ doclose, %% bool
223
+ chunked, %% bool
224
+ encoding=identity,
225
+ %% identity, deflate
226
+ contlen, %% integer
227
+ act_contlen, %% actual content length for dynamic pages
228
+
229
+
230
+ %% and the total set of out headers we can have
231
+ %% as actual strings
232
+ connection,
233
+ server,
234
+ location,
235
+ cache_control,
236
+ date,
237
+ allow,
238
+ last_modified,
239
+ etag,
240
+ set_cookie,
241
+ content_range,
242
+ content_length,
243
+ content_type,
244
+ content_encoding,
245
+ transfer_encoding,
246
+ www_authenticate,
247
+ other %% misc other headers
248
+ }).
249
+
250
+
251
+
252
+ -define(READ_TIMEOUT, 30000).
253
+
254
+
255
+
256
+
257
+ -record(appmodspec, {
258
+ type, %% atom, pair or absolute
259
+ data}).
260
+
261
+
262
+ %% as read by application:get_env()
263
+ -record(env, {debug,
264
+ trace,
265
+ traceoutput,
266
+ conf,
267
+ runmod,
268
+ embedded,
269
+ id
270
+ }).
271
+