technomancy-rack 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/KNOWN-ISSUES +18 -0
- data/README +242 -0
- data/bin/rackup +183 -0
- data/lib/rack.rb +92 -0
- data/lib/rack/adapter/camping.rb +22 -0
- data/lib/rack/auth/abstract/handler.rb +28 -0
- data/lib/rack/auth/abstract/request.rb +37 -0
- data/lib/rack/auth/basic.rb +58 -0
- data/lib/rack/auth/digest/md5.rb +124 -0
- data/lib/rack/auth/digest/nonce.rb +51 -0
- data/lib/rack/auth/digest/params.rb +55 -0
- data/lib/rack/auth/digest/request.rb +40 -0
- data/lib/rack/auth/openid.rb +116 -0
- data/lib/rack/builder.rb +56 -0
- data/lib/rack/cascade.rb +36 -0
- data/lib/rack/commonlogger.rb +56 -0
- data/lib/rack/file.rb +112 -0
- data/lib/rack/handler/cgi.rb +57 -0
- data/lib/rack/handler/fastcgi.rb +83 -0
- data/lib/rack/handler/lsws.rb +52 -0
- data/lib/rack/handler/mongrel.rb +97 -0
- data/lib/rack/handler/scgi.rb +57 -0
- data/lib/rack/handler/webrick.rb +57 -0
- data/lib/rack/lint.rb +394 -0
- data/lib/rack/lobster.rb +65 -0
- data/lib/rack/mock.rb +172 -0
- data/lib/rack/recursive.rb +57 -0
- data/lib/rack/reloader.rb +64 -0
- data/lib/rack/request.rb +197 -0
- data/lib/rack/response.rb +166 -0
- data/lib/rack/session/abstract/id.rb +126 -0
- data/lib/rack/session/cookie.rb +71 -0
- data/lib/rack/session/memcache.rb +83 -0
- data/lib/rack/session/pool.rb +67 -0
- data/lib/rack/showexceptions.rb +344 -0
- data/lib/rack/showstatus.rb +103 -0
- data/lib/rack/static.rb +38 -0
- data/lib/rack/urlmap.rb +48 -0
- data/lib/rack/utils.rb +256 -0
- data/test/spec_rack_auth_basic.rb +69 -0
- data/test/spec_rack_auth_digest.rb +169 -0
- data/test/spec_rack_builder.rb +50 -0
- data/test/spec_rack_camping.rb +47 -0
- data/test/spec_rack_cascade.rb +50 -0
- data/test/spec_rack_cgi.rb +91 -0
- data/test/spec_rack_commonlogger.rb +32 -0
- data/test/spec_rack_fastcgi.rb +91 -0
- data/test/spec_rack_file.rb +40 -0
- data/test/spec_rack_lint.rb +317 -0
- data/test/spec_rack_lobster.rb +45 -0
- data/test/spec_rack_mock.rb +152 -0
- data/test/spec_rack_mongrel.rb +165 -0
- data/test/spec_rack_recursive.rb +77 -0
- data/test/spec_rack_request.rb +384 -0
- data/test/spec_rack_response.rb +167 -0
- data/test/spec_rack_session_cookie.rb +49 -0
- data/test/spec_rack_session_memcache.rb +100 -0
- data/test/spec_rack_session_pool.rb +84 -0
- data/test/spec_rack_showexceptions.rb +21 -0
- data/test/spec_rack_showstatus.rb +71 -0
- data/test/spec_rack_static.rb +37 -0
- data/test/spec_rack_urlmap.rb +175 -0
- data/test/spec_rack_utils.rb +69 -0
- data/test/spec_rack_webrick.rb +106 -0
- data/test/testrequest.rb +43 -0
- metadata +167 -0
data/KNOWN-ISSUES
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
= Known issues with Rack and Web servers
|
2
|
+
|
3
|
+
* Lighttpd sets wrong SCRIPT_NAME and PATH_INFO if you mount your
|
4
|
+
FastCGI app at "/". This can be fixed by using this middleware:
|
5
|
+
|
6
|
+
class LighttpdScriptNameFix
|
7
|
+
def initialize(app)
|
8
|
+
@app = app
|
9
|
+
end
|
10
|
+
|
11
|
+
def call(env)
|
12
|
+
env["PATH_INFO"] = env["SCRIPT_NAME"].to_s + env["PATH_INFO"].to_s
|
13
|
+
env["SCRIPT_NAME"] = ""
|
14
|
+
@app.call(env)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
Of course, use this only when your app runs at "/".
|
data/README
ADDED
@@ -0,0 +1,242 @@
|
|
1
|
+
= Rack, a modular Ruby webserver interface
|
2
|
+
|
3
|
+
Rack provides a minimal, modular and adaptable interface for developing
|
4
|
+
web applications in Ruby. By wrapping HTTP requests and responses in
|
5
|
+
the simplest way possible, it unifies and distills the API for web
|
6
|
+
servers, web frameworks, and software in between (the so-called
|
7
|
+
middleware) into a single method call.
|
8
|
+
|
9
|
+
The exact details of this are described in the Rack specification,
|
10
|
+
which all Rack applications should conform to.
|
11
|
+
|
12
|
+
== Supported web servers
|
13
|
+
|
14
|
+
The included *handlers* connect all kinds of web servers to Rack:
|
15
|
+
* Mongrel
|
16
|
+
* Mongrel/Swiftcore (require it before requiring rack)
|
17
|
+
* WEBrick
|
18
|
+
* FCGI
|
19
|
+
* CGI
|
20
|
+
* SCGI
|
21
|
+
* LiteSpeed
|
22
|
+
|
23
|
+
These web servers include Rack handlers in their distributions:
|
24
|
+
* Ebb
|
25
|
+
* Fuzed
|
26
|
+
* Thin
|
27
|
+
|
28
|
+
Any valid Rack app will run the same on all these handlers, without
|
29
|
+
changing anything.
|
30
|
+
|
31
|
+
== Supported web frameworks
|
32
|
+
|
33
|
+
The included *adapters* connect Rack with existing Ruby web frameworks:
|
34
|
+
* Camping
|
35
|
+
|
36
|
+
These frameworks include Rack adapters in their distributions:
|
37
|
+
* Coset
|
38
|
+
* Halcyon
|
39
|
+
* Maveric
|
40
|
+
* Merb
|
41
|
+
* Racktools::SimpleApplication
|
42
|
+
* Ramaze
|
43
|
+
* Sinatra
|
44
|
+
* Vintage
|
45
|
+
|
46
|
+
Ruby on Rails can be run with the adapter included with Thin, which
|
47
|
+
will be merged into a later Rack version.
|
48
|
+
|
49
|
+
Current links to these projects can be found at
|
50
|
+
http://ramaze.net/#other-frameworks
|
51
|
+
|
52
|
+
== Available middleware
|
53
|
+
|
54
|
+
Between the server and the framework, Rack can be customized to your
|
55
|
+
applications needs using middleware, for example:
|
56
|
+
* Rack::URLMap, to route to multiple applications inside the same process.
|
57
|
+
* Rack::CommonLogger, for creating Apache-style logfiles.
|
58
|
+
* Rack::ShowException, for catching unhandled exceptions and
|
59
|
+
presenting them in a nice and helpful way with clickable backtrace.
|
60
|
+
* Rack::File, for serving static files.
|
61
|
+
* ...many others!
|
62
|
+
|
63
|
+
All these components use the same interface, which is described in
|
64
|
+
detail in the Rack specification. You can choose to use them exactly
|
65
|
+
in the way you want.
|
66
|
+
|
67
|
+
== Convenience
|
68
|
+
|
69
|
+
If you want to develop outside of existing frameworks, implement your
|
70
|
+
own ones, or develop middleware, Rack provides many helpers to create
|
71
|
+
Rack applications quickly and without doing the same web stuff all
|
72
|
+
over:
|
73
|
+
* Rack::Request, which also provides query string parsing and
|
74
|
+
multipart handling.
|
75
|
+
* Rack::Response, for convenient generation of HTTP replies and
|
76
|
+
cookie handling.
|
77
|
+
* Rack::MockRequest and Rack::MockResponse for efficient and quick
|
78
|
+
testing of Rack application without real HTTP round-trips.
|
79
|
+
|
80
|
+
== rackup
|
81
|
+
|
82
|
+
rackup is a useful tool for running Rack applications, which uses the
|
83
|
+
Rack::Builder DSL to configure middleware and build up applications
|
84
|
+
easily.
|
85
|
+
|
86
|
+
rackup automatically figures out the environment it is run in, and
|
87
|
+
runs your application as FastCGI, CGI, or standalone with Mongrel or
|
88
|
+
WEBrick---all from the same configuration.
|
89
|
+
|
90
|
+
== Quick start
|
91
|
+
|
92
|
+
Try the lobster!
|
93
|
+
|
94
|
+
Either with the embedded WEBrick starter:
|
95
|
+
|
96
|
+
ruby -Ilib lib/rack/lobster.rb
|
97
|
+
|
98
|
+
Or with rackup:
|
99
|
+
|
100
|
+
bin/rackup -Ilib example/lobster.ru
|
101
|
+
|
102
|
+
By default, the lobster is found at http://localhost:9292.
|
103
|
+
|
104
|
+
== Installing with RubyGems
|
105
|
+
|
106
|
+
A Gem of Rack is available. You can install it with:
|
107
|
+
|
108
|
+
gem install rack
|
109
|
+
|
110
|
+
I also provide a local mirror of the gems (and development snapshots)
|
111
|
+
at my site:
|
112
|
+
|
113
|
+
gem install rack --source http://chneukirchen.org/releases/gems
|
114
|
+
|
115
|
+
== Running the tests
|
116
|
+
|
117
|
+
Testing Rack requires the test/spec testing framework:
|
118
|
+
|
119
|
+
gem install test-spec
|
120
|
+
|
121
|
+
The full set of tests also test FCGI access with lighttpd so you will
|
122
|
+
need lighttpd installed as well as the FCGI libraries and the fcgi gem
|
123
|
+
installed:
|
124
|
+
|
125
|
+
Download and install lighttpd:
|
126
|
+
|
127
|
+
http://www.lighttpd.net/download
|
128
|
+
|
129
|
+
Installing the FCGI libraries:
|
130
|
+
|
131
|
+
curl -O http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
|
132
|
+
tar xzvf fcgi-2.4.0.tar.gz
|
133
|
+
cd fcgi-2.4.0
|
134
|
+
./configure --prefix=/usr/local
|
135
|
+
make
|
136
|
+
sudo make install
|
137
|
+
cd ..
|
138
|
+
|
139
|
+
Installing the Ruby fcgi gem:
|
140
|
+
|
141
|
+
gem install fcgi
|
142
|
+
|
143
|
+
There are two rake-based test tasks:
|
144
|
+
|
145
|
+
rake test tests all the fast tests (no Handlers or Adapters)
|
146
|
+
rake fulltest runs all the tests
|
147
|
+
|
148
|
+
== History
|
149
|
+
|
150
|
+
* March 3rd, 2007: First public release 0.1.
|
151
|
+
|
152
|
+
* May 16th, 2007: Second public release 0.2.
|
153
|
+
* HTTP Basic authentication.
|
154
|
+
* Cookie Sessions.
|
155
|
+
* Static file handler.
|
156
|
+
* Improved Rack::Request.
|
157
|
+
* Improved Rack::Response.
|
158
|
+
* Added Rack::ShowStatus, for better default error messages.
|
159
|
+
* Bug fixes in the Camping adapter.
|
160
|
+
* Removed Rails adapter, was too alpha.
|
161
|
+
|
162
|
+
* February 26th, 2008: Third public release 0.3.
|
163
|
+
* LiteSpeed handler, by Adrian Madrid.
|
164
|
+
* SCGI handler, by Jeremy Evans.
|
165
|
+
* Pool sessions, by blink.
|
166
|
+
* OpenID authentication, by blink.
|
167
|
+
* :Port and :File options for opening FastCGI sockets, by blink.
|
168
|
+
* Last-Modified HTTP header for Rack::File, by blink.
|
169
|
+
* Rack::Builder#use now accepts blocks, by Corey Jewett.
|
170
|
+
(See example/protectedlobster.ru)
|
171
|
+
* HTTP status 201 can contain a Content-Type and a body now.
|
172
|
+
* Many bugfixes, especially related to Cookie handling.
|
173
|
+
|
174
|
+
* XXX, 2008: Fourth public release 0.4.
|
175
|
+
* New Memcache sessions, by blink.
|
176
|
+
* Rack::Reloader is not loaded in rackup development mode.
|
177
|
+
* Many bugfixes, especially for pool sessions and URLMap.
|
178
|
+
|
179
|
+
== Contact
|
180
|
+
|
181
|
+
Please mail bugs, suggestions and patches to
|
182
|
+
<mailto:chneukirchen@gmail.com>.
|
183
|
+
|
184
|
+
Darcs repository ("darcs send" is welcome for patches):
|
185
|
+
http://chneukirchen.org/repos/rack
|
186
|
+
|
187
|
+
You are also welcome to join the #rack channel on irc.freenode.net.
|
188
|
+
|
189
|
+
== Thanks to
|
190
|
+
|
191
|
+
* blink for the Pool sessions, OpenID support, many tweaks, patches
|
192
|
+
and bugreports.
|
193
|
+
* Michael Fellinger, for the helpful discussion, bugfixes and a better
|
194
|
+
Rack::Request interface.
|
195
|
+
* Adrian Madrid, for the LiteSpeed handler.
|
196
|
+
* Christoffer Sawicki, for the Rails adapter.
|
197
|
+
* Tim Fletcher, for the HTTP authentication code.
|
198
|
+
* Luc Heinrich for the Cookie sessions, the static file handler and bugfixes.
|
199
|
+
* Armin Ronacher, for the logo and racktools.
|
200
|
+
* Aredridel, for bug fixing.
|
201
|
+
* Stephen Bannasch, for bug reports and documentation.
|
202
|
+
* Gary Wright, for proposing a better Rack::Response interface.
|
203
|
+
* Jonathan Buch, for improvements regarding Rack::Response.
|
204
|
+
* Armin Röhrl, for tracking down bugs in the Cookie generator.
|
205
|
+
* Alexander Kellett for testing the Gem and reviewing the announce.
|
206
|
+
* Marcus Rückert, for help with configuring and debugging lighttpd.
|
207
|
+
* The WSGI team for the well-done and documented work they've done and
|
208
|
+
Rack builds up on.
|
209
|
+
|
210
|
+
== Copyright
|
211
|
+
|
212
|
+
Copyright (C) 2007, 2008 Christian Neukirchen <http://purl.org/net/chneukirchen>
|
213
|
+
|
214
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
215
|
+
of this software and associated documentation files (the "Software"), to
|
216
|
+
deal in the Software without restriction, including without limitation the
|
217
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
218
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
219
|
+
furnished to do so, subject to the following conditions:
|
220
|
+
|
221
|
+
The above copyright notice and this permission notice shall be included in
|
222
|
+
all copies or substantial portions of the Software.
|
223
|
+
|
224
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
225
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
226
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
227
|
+
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
228
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
229
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
230
|
+
|
231
|
+
== Links
|
232
|
+
|
233
|
+
Rack:: <http://rack.rubyforge.org/>
|
234
|
+
Rack's Rubyforge project:: <http://rubyforge.org/projects/rack>
|
235
|
+
|
236
|
+
Camping:: <http://camping.rubyforge.org/>
|
237
|
+
Ramaze:: <http://ramaze.rubyforge.org/>
|
238
|
+
Maveric:: <http://maveric.rubyforge.org/>
|
239
|
+
racktools:: <http://lucumr.pocoo.org/trac/repos/racktools/>
|
240
|
+
|
241
|
+
Christian Neukirchen:: <http://chneukirchen.org/>
|
242
|
+
|
data/bin/rackup
ADDED
@@ -0,0 +1,183 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- ruby -*-
|
3
|
+
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
automatic = false
|
7
|
+
server = nil
|
8
|
+
env = "development"
|
9
|
+
daemonize = false
|
10
|
+
pid = nil
|
11
|
+
options = {:Port => 9292, :Host => "0.0.0.0", :AccessLog => []}
|
12
|
+
|
13
|
+
opts = OptionParser.new("", 24, ' ') { |opts|
|
14
|
+
opts.banner = "Usage: rackup [ruby options] [rack options] [rackup config]"
|
15
|
+
|
16
|
+
opts.separator ""
|
17
|
+
opts.separator "Ruby options:"
|
18
|
+
|
19
|
+
lineno = 1
|
20
|
+
opts.on("-e", "--eval LINE", "evaluate a LINE of code") { |line|
|
21
|
+
eval line, TOPLEVEL_BINDING, "-e", lineno
|
22
|
+
lineno += 1
|
23
|
+
}
|
24
|
+
|
25
|
+
opts.on("-d", "--debug", "set debugging flags (set $DEBUG to true)") {
|
26
|
+
$DEBUG = true
|
27
|
+
}
|
28
|
+
opts.on("-w", "--warn", "turn warnings on for your script") {
|
29
|
+
$-w = true
|
30
|
+
}
|
31
|
+
|
32
|
+
opts.on("-I", "--include PATH",
|
33
|
+
"specify $LOAD_PATH (may be used more than once)") { |path|
|
34
|
+
$LOAD_PATH.unshift(*path.split(":"))
|
35
|
+
}
|
36
|
+
|
37
|
+
opts.on("-r", "--require LIBRARY",
|
38
|
+
"require the library, before executing your script") { |library|
|
39
|
+
require library
|
40
|
+
}
|
41
|
+
|
42
|
+
opts.separator ""
|
43
|
+
opts.separator "Rack options:"
|
44
|
+
opts.on("-s", "--server SERVER", "serve using SERVER (webrick/mongrel)") { |s|
|
45
|
+
server = s
|
46
|
+
}
|
47
|
+
|
48
|
+
opts.on("-o", "--host HOST", "listen on HOST (default: 0.0.0.0)") { |host|
|
49
|
+
options[:Host] = host
|
50
|
+
}
|
51
|
+
|
52
|
+
opts.on("-p", "--port PORT", "use PORT (default: 9292)") { |port|
|
53
|
+
options[:Port] = port
|
54
|
+
}
|
55
|
+
|
56
|
+
opts.on("-E", "--env ENVIRONMENT", "use ENVIRONMENT for defaults (default: development)") { |e|
|
57
|
+
env = e
|
58
|
+
}
|
59
|
+
|
60
|
+
opts.on("-D", "--daemonize", "run daemonized in the background") { |d|
|
61
|
+
daemonize = d ? true : false
|
62
|
+
}
|
63
|
+
|
64
|
+
opts.on("-P", "--pid FILE", "file to store PID (default: rack.pid)") { |f|
|
65
|
+
pid = File.expand_path(f)
|
66
|
+
}
|
67
|
+
|
68
|
+
opts.separator ""
|
69
|
+
opts.separator "Common options:"
|
70
|
+
|
71
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
72
|
+
puts opts
|
73
|
+
exit
|
74
|
+
end
|
75
|
+
|
76
|
+
opts.on_tail("--version", "Show version") do
|
77
|
+
require 'rack'
|
78
|
+
puts "Rack #{Rack.version}"
|
79
|
+
exit
|
80
|
+
end
|
81
|
+
|
82
|
+
opts.parse! ARGV
|
83
|
+
}
|
84
|
+
|
85
|
+
require 'pp' if $DEBUG
|
86
|
+
|
87
|
+
config = ARGV[0] || "config.ru"
|
88
|
+
if !File.exist? config
|
89
|
+
abort "configuration #{config} not found"
|
90
|
+
end
|
91
|
+
|
92
|
+
if config =~ /\.ru$/
|
93
|
+
cfgfile = File.read(config)
|
94
|
+
if cfgfile[/^#\\(.*)/]
|
95
|
+
opts.parse! $1.split(/\s+/)
|
96
|
+
end
|
97
|
+
require 'rack'
|
98
|
+
inner_app = eval "Rack::Builder.new {( " + cfgfile + "\n )}.to_app",
|
99
|
+
nil, config
|
100
|
+
else
|
101
|
+
require 'rack'
|
102
|
+
require config
|
103
|
+
inner_app = Object.const_get(File.basename(config, '.rb').capitalize)
|
104
|
+
end
|
105
|
+
|
106
|
+
case server
|
107
|
+
when nil
|
108
|
+
# Guess.
|
109
|
+
if ENV.include?("PHP_FCGI_CHILDREN")
|
110
|
+
server = Rack::Handler::FastCGI
|
111
|
+
|
112
|
+
# We already speak FastCGI
|
113
|
+
options.delete :File
|
114
|
+
options.delete :Port
|
115
|
+
elsif ENV.include?("REQUEST_METHOD")
|
116
|
+
server = Rack::Handler::CGI
|
117
|
+
else
|
118
|
+
begin
|
119
|
+
server = Rack::Handler::Mongrel
|
120
|
+
rescue LoadError => e
|
121
|
+
server = Rack::Handler::WEBrick
|
122
|
+
end
|
123
|
+
end
|
124
|
+
when "mongrel"
|
125
|
+
server = Rack::Handler::Mongrel
|
126
|
+
when "webrick"
|
127
|
+
server = Rack::Handler::WEBrick
|
128
|
+
when "cgi"
|
129
|
+
server = Rack::Handler::CGI
|
130
|
+
when "fastcgi"
|
131
|
+
server = Rack::Handler::FastCGI
|
132
|
+
else
|
133
|
+
server = Rack::Handler.const_get(server.capitalize)
|
134
|
+
end
|
135
|
+
|
136
|
+
p server if $DEBUG
|
137
|
+
|
138
|
+
case env
|
139
|
+
when "development"
|
140
|
+
app = Rack::Builder.new {
|
141
|
+
use Rack::CommonLogger, STDERR unless server.name =~ /CGI/
|
142
|
+
use Rack::ShowExceptions
|
143
|
+
use Rack::Lint
|
144
|
+
run inner_app
|
145
|
+
}.to_app
|
146
|
+
|
147
|
+
when "deployment"
|
148
|
+
app = Rack::Builder.new {
|
149
|
+
use Rack::CommonLogger, STDERR unless server.name =~ /CGI/
|
150
|
+
run inner_app
|
151
|
+
}.to_app
|
152
|
+
|
153
|
+
when "none"
|
154
|
+
app = inner_app
|
155
|
+
|
156
|
+
end
|
157
|
+
|
158
|
+
if $DEBUG
|
159
|
+
pp app
|
160
|
+
pp inner_app
|
161
|
+
end
|
162
|
+
|
163
|
+
if daemonize
|
164
|
+
if RUBY_VERSION < "1.9"
|
165
|
+
exit if fork
|
166
|
+
Process.setsid
|
167
|
+
exit if fork
|
168
|
+
Dir.chdir "/"
|
169
|
+
File.umask 0000
|
170
|
+
STDIN.reopen "/dev/null"
|
171
|
+
STDOUT.reopen "/dev/null", "a"
|
172
|
+
STDERR.reopen "/dev/null", "a"
|
173
|
+
else
|
174
|
+
Process.daemon
|
175
|
+
end
|
176
|
+
|
177
|
+
if pid
|
178
|
+
File.open(pid, 'w'){ |f| f.write("#{Process.pid}") }
|
179
|
+
at_exit { File.delete(pid) if File.exist?(pid) }
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
server.run app, options
|
data/lib/rack.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
# Copyright (C) 2007, 2008 Christian Neukirchen <purl.org/net/chneukirchen>
|
2
|
+
#
|
3
|
+
# Rack is freely distributable under the terms of an MIT-style license.
|
4
|
+
# See COPYING or http://www.opensource.org/licenses/mit-license.php.
|
5
|
+
|
6
|
+
$: << File.expand_path(File.dirname(__FILE__))
|
7
|
+
|
8
|
+
|
9
|
+
# The Rack main module, serving as a namespace for all core Rack
|
10
|
+
# modules and classes.
|
11
|
+
#
|
12
|
+
# All modules meant for use in your application are <tt>autoload</tt>ed here,
|
13
|
+
# so it should be enough just to <tt>require rack.rb</tt> in your code.
|
14
|
+
|
15
|
+
module Rack
|
16
|
+
# The Rack protocol version number implemented.
|
17
|
+
VERSION = [0,1]
|
18
|
+
|
19
|
+
# Return the Rack protocol version as a dotted string.
|
20
|
+
def self.version
|
21
|
+
VERSION.join(".")
|
22
|
+
end
|
23
|
+
|
24
|
+
autoload :Builder, "rack/builder"
|
25
|
+
autoload :Cascade, "rack/cascade"
|
26
|
+
autoload :CommonLogger, "rack/commonlogger"
|
27
|
+
autoload :File, "rack/file"
|
28
|
+
autoload :ForwardRequest, "rack/recursive"
|
29
|
+
autoload :Lint, "rack/lint"
|
30
|
+
autoload :Recursive, "rack/recursive"
|
31
|
+
autoload :Reloader, "rack/reloader"
|
32
|
+
autoload :ShowExceptions, "rack/showexceptions"
|
33
|
+
autoload :ShowStatus, "rack/showstatus"
|
34
|
+
autoload :Static, "rack/static"
|
35
|
+
autoload :URLMap, "rack/urlmap"
|
36
|
+
autoload :Utils, "rack/utils"
|
37
|
+
|
38
|
+
autoload :MockRequest, "rack/mock"
|
39
|
+
autoload :MockResponse, "rack/mock"
|
40
|
+
|
41
|
+
autoload :Request, "rack/request"
|
42
|
+
autoload :Response, "rack/response"
|
43
|
+
|
44
|
+
module Auth
|
45
|
+
autoload :Basic, "rack/auth/basic"
|
46
|
+
autoload :AbstractRequest, "rack/auth/abstract/request"
|
47
|
+
autoload :AbstractHandler, "rack/auth/abstract/handler"
|
48
|
+
autoload :OpenID, "rack/auth/openid"
|
49
|
+
module Digest
|
50
|
+
autoload :MD5, "rack/auth/digest/md5"
|
51
|
+
autoload :Nonce, "rack/auth/digest/nonce"
|
52
|
+
autoload :Params, "rack/auth/digest/params"
|
53
|
+
autoload :Request, "rack/auth/digest/request"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
module Session
|
58
|
+
autoload :Cookie, "rack/session/cookie"
|
59
|
+
autoload :Pool, "rack/session/pool"
|
60
|
+
autoload :Memcache, "rack/session/memcache"
|
61
|
+
end
|
62
|
+
|
63
|
+
# *Adapters* connect Rack with third party web frameworks.
|
64
|
+
#
|
65
|
+
# Rack includes an adapter for Camping, see README for other
|
66
|
+
# frameworks supporting Rack in their code bases.
|
67
|
+
#
|
68
|
+
# Refer to the submodules for framework-specific calling details.
|
69
|
+
|
70
|
+
module Adapter
|
71
|
+
autoload :Camping, "rack/adapter/camping"
|
72
|
+
end
|
73
|
+
|
74
|
+
# *Handlers* connect web servers with Rack.
|
75
|
+
#
|
76
|
+
# Rack includes Handlers for Mongrel, WEBrick, FastCGI, CGI, SCGI
|
77
|
+
# and LiteSpeed.
|
78
|
+
#
|
79
|
+
# Handlers usually are activated by calling <tt>MyHandler.run(myapp)</tt>.
|
80
|
+
# A second optional hash can be passed to include server-specific
|
81
|
+
# configuration.
|
82
|
+
|
83
|
+
module Handler
|
84
|
+
autoload :CGI, "rack/handler/cgi"
|
85
|
+
autoload :FastCGI, "rack/handler/fastcgi"
|
86
|
+
autoload :Mongrel, "rack/handler/mongrel"
|
87
|
+
autoload :WEBrick, "rack/handler/webrick"
|
88
|
+
autoload :LSWS, "rack/handler/lsws"
|
89
|
+
autoload :SCGI, "rack/handler/scgi"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|