rack 2.1.0 → 3.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.
Potentially problematic release.
This version of rack might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +377 -16
- data/CONTRIBUTING.md +144 -0
- data/MIT-LICENSE +1 -1
- data/README.md +328 -0
- data/SPEC.rdoc +365 -0
- data/lib/rack/auth/abstract/handler.rb +3 -1
- data/lib/rack/auth/abstract/request.rb +2 -2
- data/lib/rack/auth/basic.rb +4 -7
- data/lib/rack/bad_request.rb +8 -0
- data/lib/rack/body_proxy.rb +34 -12
- data/lib/rack/builder.rb +162 -59
- data/lib/rack/cascade.rb +24 -10
- data/lib/rack/common_logger.rb +43 -28
- data/lib/rack/conditional_get.rb +30 -25
- data/lib/rack/constants.rb +66 -0
- data/lib/rack/content_length.rb +10 -16
- data/lib/rack/content_type.rb +9 -7
- data/lib/rack/deflater.rb +78 -50
- data/lib/rack/directory.rb +86 -63
- data/lib/rack/etag.rb +14 -22
- data/lib/rack/events.rb +18 -17
- data/lib/rack/files.rb +99 -61
- data/lib/rack/head.rb +8 -9
- data/lib/rack/headers.rb +238 -0
- data/lib/rack/lint.rb +868 -642
- data/lib/rack/lock.rb +2 -6
- data/lib/rack/logger.rb +3 -0
- data/lib/rack/media_type.rb +9 -4
- data/lib/rack/method_override.rb +6 -2
- data/lib/rack/mime.rb +14 -5
- data/lib/rack/mock.rb +1 -253
- data/lib/rack/mock_request.rb +171 -0
- data/lib/rack/mock_response.rb +124 -0
- data/lib/rack/multipart/generator.rb +15 -8
- data/lib/rack/multipart/parser.rb +238 -107
- data/lib/rack/multipart/uploaded_file.rb +17 -7
- data/lib/rack/multipart.rb +54 -42
- data/lib/rack/null_logger.rb +9 -0
- data/lib/rack/query_parser.rb +87 -105
- data/lib/rack/recursive.rb +3 -1
- data/lib/rack/reloader.rb +0 -4
- data/lib/rack/request.rb +366 -135
- data/lib/rack/response.rb +186 -68
- data/lib/rack/rewindable_input.rb +24 -6
- data/lib/rack/runtime.rb +8 -7
- data/lib/rack/sendfile.rb +29 -27
- data/lib/rack/show_exceptions.rb +27 -12
- data/lib/rack/show_status.rb +21 -13
- data/lib/rack/static.rb +19 -12
- data/lib/rack/tempfile_reaper.rb +14 -5
- data/lib/rack/urlmap.rb +5 -6
- data/lib/rack/utils.rb +274 -260
- data/lib/rack/version.rb +21 -0
- data/lib/rack.rb +18 -103
- metadata +25 -52
- data/README.rdoc +0 -262
- data/Rakefile +0 -123
- data/SPEC +0 -263
- data/bin/rackup +0 -5
- data/contrib/rack.png +0 -0
- data/contrib/rack.svg +0 -150
- data/contrib/rack_logo.svg +0 -164
- data/contrib/rdoc.css +0 -412
- data/example/lobster.ru +0 -6
- data/example/protectedlobster.rb +0 -16
- data/example/protectedlobster.ru +0 -10
- data/lib/rack/auth/digest/md5.rb +0 -131
- data/lib/rack/auth/digest/nonce.rb +0 -54
- data/lib/rack/auth/digest/params.rb +0 -54
- data/lib/rack/auth/digest/request.rb +0 -43
- data/lib/rack/chunked.rb +0 -92
- data/lib/rack/core_ext/regexp.rb +0 -14
- data/lib/rack/file.rb +0 -8
- data/lib/rack/handler/cgi.rb +0 -62
- data/lib/rack/handler/fastcgi.rb +0 -102
- data/lib/rack/handler/lsws.rb +0 -63
- data/lib/rack/handler/scgi.rb +0 -73
- data/lib/rack/handler/thin.rb +0 -38
- data/lib/rack/handler/webrick.rb +0 -122
- data/lib/rack/handler.rb +0 -104
- data/lib/rack/lobster.rb +0 -72
- data/lib/rack/server.rb +0 -467
- data/lib/rack/session/abstract/id.rb +0 -528
- data/lib/rack/session/cookie.rb +0 -205
- data/lib/rack/session/memcache.rb +0 -10
- data/lib/rack/session/pool.rb +0 -85
- data/rack.gemspec +0 -44
data/Rakefile
DELETED
@@ -1,123 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "rake/testtask"
|
4
|
-
|
5
|
-
desc "Run all the tests"
|
6
|
-
task default: :test
|
7
|
-
|
8
|
-
desc "Install gem dependencies"
|
9
|
-
task :deps do
|
10
|
-
require 'rubygems'
|
11
|
-
spec = Gem::Specification.load('rack.gemspec')
|
12
|
-
spec.dependencies.each do |dep|
|
13
|
-
reqs = dep.requirements_list
|
14
|
-
reqs = (["-v"] * reqs.size).zip(reqs).flatten
|
15
|
-
# Use system over sh, because we want to ignore errors!
|
16
|
-
system Gem.ruby, "-S", "gem", "install", '--conservative', dep.name, *reqs
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
desc "Make an archive as .tar.gz"
|
21
|
-
task dist: %w[chmod changelog spec rdoc] do
|
22
|
-
sh "git archive --format=tar --prefix=#{release}/ HEAD^{tree} >#{release}.tar"
|
23
|
-
sh "pax -waf #{release}.tar -s ':^:#{release}/:' SPEC ChangeLog doc rack.gemspec"
|
24
|
-
sh "gzip -f -9 #{release}.tar"
|
25
|
-
end
|
26
|
-
|
27
|
-
desc "Make an official release"
|
28
|
-
task :officialrelease do
|
29
|
-
puts "Official build for #{release}..."
|
30
|
-
sh "rm -rf stage"
|
31
|
-
sh "git clone --shared . stage"
|
32
|
-
sh "cd stage && rake officialrelease_really"
|
33
|
-
sh "mv stage/#{release}.tar.gz stage/#{release}.gem ."
|
34
|
-
end
|
35
|
-
|
36
|
-
task officialrelease_really: %w[spec dist gem] do
|
37
|
-
sh "shasum #{release}.tar.gz #{release}.gem"
|
38
|
-
end
|
39
|
-
|
40
|
-
def release
|
41
|
-
"rack-" + File.read('lib/rack.rb')[/RELEASE += +([\"\'])([\d][\w\.]+)\1/, 2]
|
42
|
-
end
|
43
|
-
|
44
|
-
desc "Make binaries executable"
|
45
|
-
task :chmod do
|
46
|
-
Dir["bin/*"].each { |binary| File.chmod(0755, binary) }
|
47
|
-
Dir["test/cgi/test*"].each { |binary| File.chmod(0755, binary) }
|
48
|
-
end
|
49
|
-
|
50
|
-
desc "Generate a ChangeLog"
|
51
|
-
task changelog: "ChangeLog"
|
52
|
-
|
53
|
-
file '.git/index'
|
54
|
-
file "ChangeLog" => '.git/index' do
|
55
|
-
File.open("ChangeLog", "w") { |out|
|
56
|
-
log = `git log -z`
|
57
|
-
log.force_encoding(Encoding::BINARY)
|
58
|
-
log.split("\0").map { |chunk|
|
59
|
-
author = chunk[/Author: (.*)/, 1].strip
|
60
|
-
date = chunk[/Date: (.*)/, 1].strip
|
61
|
-
desc, detail = $'.strip.split("\n", 2)
|
62
|
-
detail ||= ""
|
63
|
-
detail = detail.gsub(/.*darcs-hash:.*/, '')
|
64
|
-
detail.rstrip!
|
65
|
-
out.puts "#{date} #{author}"
|
66
|
-
out.puts " * #{desc.strip}"
|
67
|
-
out.puts detail unless detail.empty?
|
68
|
-
out.puts
|
69
|
-
}
|
70
|
-
}
|
71
|
-
end
|
72
|
-
|
73
|
-
desc "Generate Rack Specification"
|
74
|
-
task spec: "SPEC"
|
75
|
-
|
76
|
-
file 'lib/rack/lint.rb'
|
77
|
-
file "SPEC" => 'lib/rack/lint.rb' do
|
78
|
-
File.open("SPEC", "wb") { |file|
|
79
|
-
IO.foreach("lib/rack/lint.rb") { |line|
|
80
|
-
if line =~ /## (.*)/
|
81
|
-
file.puts $1
|
82
|
-
end
|
83
|
-
}
|
84
|
-
}
|
85
|
-
end
|
86
|
-
|
87
|
-
Rake::TestTask.new("test:regular") do |t|
|
88
|
-
t.libs << "test"
|
89
|
-
t.test_files = FileList["test/**/*_test.rb", "test/**/spec_*.rb", "test/gemloader.rb"]
|
90
|
-
t.warning = false
|
91
|
-
t.verbose = true
|
92
|
-
end
|
93
|
-
|
94
|
-
desc "Run all the fast + platform agnostic tests"
|
95
|
-
task test: %w[spec test:regular]
|
96
|
-
|
97
|
-
desc "Run all the tests we run on CI"
|
98
|
-
task ci: :test
|
99
|
-
|
100
|
-
task gem: :spec do
|
101
|
-
sh "gem build rack.gemspec"
|
102
|
-
end
|
103
|
-
|
104
|
-
task doc: :rdoc
|
105
|
-
|
106
|
-
desc "Generate RDoc documentation"
|
107
|
-
task rdoc: %w[changelog spec] do
|
108
|
-
sh(*%w{rdoc --line-numbers --main README.rdoc
|
109
|
-
--title 'Rack\ Documentation' --charset utf-8 -U -o doc} +
|
110
|
-
%w{README.rdoc KNOWN-ISSUES SPEC ChangeLog} +
|
111
|
-
`git ls-files lib/\*\*/\*.rb`.strip.split)
|
112
|
-
cp "contrib/rdoc.css", "doc/rdoc.css"
|
113
|
-
end
|
114
|
-
|
115
|
-
task pushdoc: :rdoc do
|
116
|
-
sh "rsync -avz doc/ rack.rubyforge.org:/var/www/gforge-projects/rack/doc/"
|
117
|
-
end
|
118
|
-
|
119
|
-
task pushsite: :pushdoc do
|
120
|
-
sh "cd site && git gc"
|
121
|
-
sh "rsync -avz site/ rack.rubyforge.org:/var/www/gforge-projects/rack/"
|
122
|
-
sh "cd site && git push"
|
123
|
-
end
|
data/SPEC
DELETED
@@ -1,263 +0,0 @@
|
|
1
|
-
This specification aims to formalize the Rack protocol. You
|
2
|
-
can (and should) use Rack::Lint to enforce it.
|
3
|
-
When you develop middleware, be sure to add a Lint before and
|
4
|
-
after to catch all mistakes.
|
5
|
-
= Rack applications
|
6
|
-
A Rack application is a Ruby object (not a class) that
|
7
|
-
responds to +call+.
|
8
|
-
It takes exactly one argument, the *environment*
|
9
|
-
and returns an Array of exactly three values:
|
10
|
-
The *status*,
|
11
|
-
the *headers*,
|
12
|
-
and the *body*.
|
13
|
-
== The Environment
|
14
|
-
The environment must be an instance of Hash that includes
|
15
|
-
CGI-like headers. The application is free to modify the
|
16
|
-
environment.
|
17
|
-
The environment is required to include these variables
|
18
|
-
(adopted from PEP333), except when they'd be empty, but see
|
19
|
-
below.
|
20
|
-
<tt>REQUEST_METHOD</tt>:: The HTTP request method, such as
|
21
|
-
"GET" or "POST". This cannot ever
|
22
|
-
be an empty string, and so is
|
23
|
-
always required.
|
24
|
-
<tt>SCRIPT_NAME</tt>:: The initial portion of the request
|
25
|
-
URL's "path" that corresponds to the
|
26
|
-
application object, so that the
|
27
|
-
application knows its virtual
|
28
|
-
"location". This may be an empty
|
29
|
-
string, if the application corresponds
|
30
|
-
to the "root" of the server.
|
31
|
-
<tt>PATH_INFO</tt>:: The remainder of the request URL's
|
32
|
-
"path", designating the virtual
|
33
|
-
"location" of the request's target
|
34
|
-
within the application. This may be an
|
35
|
-
empty string, if the request URL targets
|
36
|
-
the application root and does not have a
|
37
|
-
trailing slash. This value may be
|
38
|
-
percent-encoded when originating from
|
39
|
-
a URL.
|
40
|
-
<tt>QUERY_STRING</tt>:: The portion of the request URL that
|
41
|
-
follows the <tt>?</tt>, if any. May be
|
42
|
-
empty, but is always required!
|
43
|
-
<tt>SERVER_NAME</tt>, <tt>SERVER_PORT</tt>::
|
44
|
-
When combined with <tt>SCRIPT_NAME</tt> and
|
45
|
-
<tt>PATH_INFO</tt>, these variables can be
|
46
|
-
used to complete the URL. Note, however,
|
47
|
-
that <tt>HTTP_HOST</tt>, if present,
|
48
|
-
should be used in preference to
|
49
|
-
<tt>SERVER_NAME</tt> for reconstructing
|
50
|
-
the request URL.
|
51
|
-
<tt>SERVER_NAME</tt> and <tt>SERVER_PORT</tt>
|
52
|
-
can never be empty strings, and so
|
53
|
-
are always required.
|
54
|
-
<tt>HTTP_</tt> Variables:: Variables corresponding to the
|
55
|
-
client-supplied HTTP request
|
56
|
-
headers (i.e., variables whose
|
57
|
-
names begin with <tt>HTTP_</tt>). The
|
58
|
-
presence or absence of these
|
59
|
-
variables should correspond with
|
60
|
-
the presence or absence of the
|
61
|
-
appropriate HTTP header in the
|
62
|
-
request. See
|
63
|
-
{RFC3875 section 4.1.18}[https://tools.ietf.org/html/rfc3875#section-4.1.18]
|
64
|
-
for specific behavior.
|
65
|
-
In addition to this, the Rack environment must include these
|
66
|
-
Rack-specific variables:
|
67
|
-
<tt>rack.version</tt>:: The Array representing this version of Rack
|
68
|
-
See Rack::VERSION, that corresponds to
|
69
|
-
the version of this SPEC.
|
70
|
-
<tt>rack.url_scheme</tt>:: +http+ or +https+, depending on the
|
71
|
-
request URL.
|
72
|
-
<tt>rack.input</tt>:: See below, the input stream.
|
73
|
-
<tt>rack.errors</tt>:: See below, the error stream.
|
74
|
-
<tt>rack.multithread</tt>:: true if the application object may be
|
75
|
-
simultaneously invoked by another thread
|
76
|
-
in the same process, false otherwise.
|
77
|
-
<tt>rack.multiprocess</tt>:: true if an equivalent application object
|
78
|
-
may be simultaneously invoked by another
|
79
|
-
process, false otherwise.
|
80
|
-
<tt>rack.run_once</tt>:: true if the server expects
|
81
|
-
(but does not guarantee!) that the
|
82
|
-
application will only be invoked this one
|
83
|
-
time during the life of its containing
|
84
|
-
process. Normally, this will only be true
|
85
|
-
for a server based on CGI
|
86
|
-
(or something similar).
|
87
|
-
<tt>rack.hijack?</tt>:: present and true if the server supports
|
88
|
-
connection hijacking. See below, hijacking.
|
89
|
-
<tt>rack.hijack</tt>:: an object responding to #call that must be
|
90
|
-
called at least once before using
|
91
|
-
rack.hijack_io.
|
92
|
-
It is recommended #call return rack.hijack_io
|
93
|
-
as well as setting it in env if necessary.
|
94
|
-
<tt>rack.hijack_io</tt>:: if rack.hijack? is true, and rack.hijack
|
95
|
-
has received #call, this will contain
|
96
|
-
an object resembling an IO. See hijacking.
|
97
|
-
Additional environment specifications have approved to
|
98
|
-
standardized middleware APIs. None of these are required to
|
99
|
-
be implemented by the server.
|
100
|
-
<tt>rack.session</tt>:: A hash like interface for storing
|
101
|
-
request session data.
|
102
|
-
The store must implement:
|
103
|
-
store(key, value) (aliased as []=);
|
104
|
-
fetch(key, default = nil) (aliased as []);
|
105
|
-
delete(key);
|
106
|
-
clear;
|
107
|
-
<tt>rack.logger</tt>:: A common object interface for logging messages.
|
108
|
-
The object must implement:
|
109
|
-
info(message, &block)
|
110
|
-
debug(message, &block)
|
111
|
-
warn(message, &block)
|
112
|
-
error(message, &block)
|
113
|
-
fatal(message, &block)
|
114
|
-
<tt>rack.multipart.buffer_size</tt>:: An Integer hint to the multipart parser as to what chunk size to use for reads and writes.
|
115
|
-
<tt>rack.multipart.tempfile_factory</tt>:: An object responding to #call with two arguments, the filename and content_type given for the multipart form field, and returning an IO-like object that responds to #<< and optionally #rewind. This factory will be used to instantiate the tempfile for each multipart form file upload field, rather than the default class of Tempfile.
|
116
|
-
The server or the application can store their own data in the
|
117
|
-
environment, too. The keys must contain at least one dot,
|
118
|
-
and should be prefixed uniquely. The prefix <tt>rack.</tt>
|
119
|
-
is reserved for use with the Rack core distribution and other
|
120
|
-
accepted specifications and must not be used otherwise.
|
121
|
-
The environment must not contain the keys
|
122
|
-
<tt>HTTP_CONTENT_TYPE</tt> or <tt>HTTP_CONTENT_LENGTH</tt>
|
123
|
-
(use the versions without <tt>HTTP_</tt>).
|
124
|
-
The CGI keys (named without a period) must have String values.
|
125
|
-
There are the following restrictions:
|
126
|
-
* <tt>rack.version</tt> must be an array of Integers.
|
127
|
-
* <tt>rack.url_scheme</tt> must either be +http+ or +https+.
|
128
|
-
* There must be a valid input stream in <tt>rack.input</tt>.
|
129
|
-
* There must be a valid error stream in <tt>rack.errors</tt>.
|
130
|
-
* There may be a valid hijack stream in <tt>rack.hijack_io</tt>
|
131
|
-
* The <tt>REQUEST_METHOD</tt> must be a valid token.
|
132
|
-
* The <tt>SCRIPT_NAME</tt>, if non-empty, must start with <tt>/</tt>
|
133
|
-
* The <tt>PATH_INFO</tt>, if non-empty, must start with <tt>/</tt>
|
134
|
-
* The <tt>CONTENT_LENGTH</tt>, if given, must consist of digits only.
|
135
|
-
* One of <tt>SCRIPT_NAME</tt> or <tt>PATH_INFO</tt> must be
|
136
|
-
set. <tt>PATH_INFO</tt> should be <tt>/</tt> if
|
137
|
-
<tt>SCRIPT_NAME</tt> is empty.
|
138
|
-
<tt>SCRIPT_NAME</tt> never should be <tt>/</tt>, but instead be empty.
|
139
|
-
=== The Input Stream
|
140
|
-
The input stream is an IO-like object which contains the raw HTTP
|
141
|
-
POST data.
|
142
|
-
When applicable, its external encoding must be "ASCII-8BIT" and it
|
143
|
-
must be opened in binary mode, for Ruby 1.9 compatibility.
|
144
|
-
The input stream must respond to +gets+, +each+, +read+ and +rewind+.
|
145
|
-
* +gets+ must be called without arguments and return a string,
|
146
|
-
or +nil+ on EOF.
|
147
|
-
* +read+ behaves like IO#read.
|
148
|
-
Its signature is <tt>read([length, [buffer]])</tt>.
|
149
|
-
If given, +length+ must be a non-negative Integer (>= 0) or +nil+,
|
150
|
-
and +buffer+ must be a String and may not be nil.
|
151
|
-
If +length+ is given and not nil, then this method reads at most
|
152
|
-
+length+ bytes from the input stream.
|
153
|
-
If +length+ is not given or nil, then this method reads
|
154
|
-
all data until EOF.
|
155
|
-
When EOF is reached, this method returns nil if +length+ is given
|
156
|
-
and not nil, or "" if +length+ is not given or is nil.
|
157
|
-
If +buffer+ is given, then the read data will be placed
|
158
|
-
into +buffer+ instead of a newly created String object.
|
159
|
-
* +each+ must be called without arguments and only yield Strings.
|
160
|
-
* +rewind+ must be called without arguments. It rewinds the input
|
161
|
-
stream back to the beginning. It must not raise Errno::ESPIPE:
|
162
|
-
that is, it may not be a pipe or a socket. Therefore, handler
|
163
|
-
developers must buffer the input data into some rewindable object
|
164
|
-
if the underlying input stream is not rewindable.
|
165
|
-
* +close+ must never be called on the input stream.
|
166
|
-
=== The Error Stream
|
167
|
-
The error stream must respond to +puts+, +write+ and +flush+.
|
168
|
-
* +puts+ must be called with a single argument that responds to +to_s+.
|
169
|
-
* +write+ must be called with a single argument that is a String.
|
170
|
-
* +flush+ must be called without arguments and must be called
|
171
|
-
in order to make the error appear for sure.
|
172
|
-
* +close+ must never be called on the error stream.
|
173
|
-
=== Hijacking
|
174
|
-
==== Request (before status)
|
175
|
-
If rack.hijack? is true then rack.hijack must respond to #call.
|
176
|
-
rack.hijack must return the io that will also be assigned (or is
|
177
|
-
already present, in rack.hijack_io.
|
178
|
-
rack.hijack_io must respond to:
|
179
|
-
<tt>read, write, read_nonblock, write_nonblock, flush, close,
|
180
|
-
close_read, close_write, closed?</tt>
|
181
|
-
The semantics of these IO methods must be a best effort match to
|
182
|
-
those of a normal ruby IO or Socket object, using standard
|
183
|
-
arguments and raising standard exceptions. Servers are encouraged
|
184
|
-
to simply pass on real IO objects, although it is recognized that
|
185
|
-
this approach is not directly compatible with SPDY and HTTP 2.0.
|
186
|
-
IO provided in rack.hijack_io should preference the
|
187
|
-
IO::WaitReadable and IO::WaitWritable APIs wherever supported.
|
188
|
-
There is a deliberate lack of full specification around
|
189
|
-
rack.hijack_io, as semantics will change from server to server.
|
190
|
-
Users are encouraged to utilize this API with a knowledge of their
|
191
|
-
server choice, and servers may extend the functionality of
|
192
|
-
hijack_io to provide additional features to users. The purpose of
|
193
|
-
rack.hijack is for Rack to "get out of the way", as such, Rack only
|
194
|
-
provides the minimum of specification and support.
|
195
|
-
If rack.hijack? is false, then rack.hijack should not be set.
|
196
|
-
If rack.hijack? is false, then rack.hijack_io should not be set.
|
197
|
-
==== Response (after headers)
|
198
|
-
It is also possible to hijack a response after the status and headers
|
199
|
-
have been sent.
|
200
|
-
In order to do this, an application may set the special header
|
201
|
-
<tt>rack.hijack</tt> to an object that responds to <tt>call</tt>
|
202
|
-
accepting an argument that conforms to the <tt>rack.hijack_io</tt>
|
203
|
-
protocol.
|
204
|
-
After the headers have been sent, and this hijack callback has been
|
205
|
-
called, the application is now responsible for the remaining lifecycle
|
206
|
-
of the IO. The application is also responsible for maintaining HTTP
|
207
|
-
semantics. Of specific note, in almost all cases in the current SPEC,
|
208
|
-
applications will have wanted to specify the header Connection:close in
|
209
|
-
HTTP/1.1, and not Connection:keep-alive, as there is no protocol for
|
210
|
-
returning hijacked sockets to the web server. For that purpose, use the
|
211
|
-
body streaming API instead (progressively yielding strings via each).
|
212
|
-
Servers must ignore the <tt>body</tt> part of the response tuple when
|
213
|
-
the <tt>rack.hijack</tt> response API is in use.
|
214
|
-
The special response header <tt>rack.hijack</tt> must only be set
|
215
|
-
if the request env has <tt>rack.hijack?</tt> <tt>true</tt>.
|
216
|
-
==== Conventions
|
217
|
-
* Middleware should not use hijack unless it is handling the whole
|
218
|
-
response.
|
219
|
-
* Middleware may wrap the IO object for the response pattern.
|
220
|
-
* Middleware should not wrap the IO object for the request pattern. The
|
221
|
-
request pattern is intended to provide the hijacker with "raw tcp".
|
222
|
-
== The Response
|
223
|
-
=== The Status
|
224
|
-
This is an HTTP status. When parsed as integer (+to_i+), it must be
|
225
|
-
greater than or equal to 100.
|
226
|
-
=== The Headers
|
227
|
-
The header must respond to +each+, and yield values of key and value.
|
228
|
-
The header keys must be Strings.
|
229
|
-
Special headers starting "rack." are for communicating with the
|
230
|
-
server, and must not be sent back to the client.
|
231
|
-
The header must not contain a +Status+ key.
|
232
|
-
The header must conform to RFC7230 token specification, i.e. cannot
|
233
|
-
contain non-printable ASCII, DQUOTE or "(),/:;<=>?@[\]{}".
|
234
|
-
The values of the header must be Strings,
|
235
|
-
consisting of lines (for multiple header values, e.g. multiple
|
236
|
-
<tt>Set-Cookie</tt> values) separated by "\\n".
|
237
|
-
The lines must not contain characters below 037.
|
238
|
-
=== The Content-Type
|
239
|
-
There must not be a <tt>Content-Type</tt>, when the +Status+ is 1xx,
|
240
|
-
204 or 304.
|
241
|
-
=== The Content-Length
|
242
|
-
There must not be a <tt>Content-Length</tt> header when the
|
243
|
-
+Status+ is 1xx, 204 or 304.
|
244
|
-
=== The Body
|
245
|
-
The Body must respond to +each+
|
246
|
-
and must only yield String values.
|
247
|
-
The Body itself should not be an instance of String, as this will
|
248
|
-
break in Ruby 1.9.
|
249
|
-
If the Body responds to +close+, it will be called after iteration. If
|
250
|
-
the body is replaced by a middleware after action, the original body
|
251
|
-
must be closed first, if it responds to close.
|
252
|
-
If the Body responds to +to_path+, it must return a String
|
253
|
-
identifying the location of a file whose contents are identical
|
254
|
-
to that produced by calling +each+; this may be used by the
|
255
|
-
server as an alternative, possibly more efficient way to
|
256
|
-
transport the response.
|
257
|
-
The Body commonly is an Array of Strings, the application
|
258
|
-
instance itself, or a File-like object.
|
259
|
-
== Thanks
|
260
|
-
Some parts of this specification are adopted from PEP333: Python
|
261
|
-
Web Server Gateway Interface
|
262
|
-
v1.0 (http://www.python.org/dev/peps/pep-0333/). I'd like to thank
|
263
|
-
everyone involved in that effort.
|
data/bin/rackup
DELETED
data/contrib/rack.png
DELETED
Binary file
|
data/contrib/rack.svg
DELETED
@@ -1,150 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
-
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
3
|
-
|
4
|
-
<svg
|
5
|
-
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
|
6
|
-
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
7
|
-
xmlns:cc="http://creativecommons.org/ns#"
|
8
|
-
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
9
|
-
xmlns:svg="http://www.w3.org/2000/svg"
|
10
|
-
xmlns="http://www.w3.org/2000/svg"
|
11
|
-
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
12
|
-
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
13
|
-
width="744.09448819"
|
14
|
-
height="1052.3622047"
|
15
|
-
id="svg2"
|
16
|
-
version="1.1"
|
17
|
-
inkscape:version="0.48.3.1 r9886"
|
18
|
-
sodipodi:docname="rack.svg">
|
19
|
-
<defs
|
20
|
-
id="defs4">
|
21
|
-
<linearGradient
|
22
|
-
id="linearGradient3837"
|
23
|
-
osb:paint="solid">
|
24
|
-
<stop
|
25
|
-
style="stop-color:#000000;stop-opacity:1;"
|
26
|
-
offset="0"
|
27
|
-
id="stop3839" />
|
28
|
-
</linearGradient>
|
29
|
-
</defs>
|
30
|
-
<sodipodi:namedview
|
31
|
-
id="base"
|
32
|
-
pagecolor="#ffffff"
|
33
|
-
bordercolor="#666666"
|
34
|
-
borderopacity="1.0"
|
35
|
-
inkscape:pageopacity="0.0"
|
36
|
-
inkscape:pageshadow="2"
|
37
|
-
inkscape:zoom="0.98994949"
|
38
|
-
inkscape:cx="230.49849"
|
39
|
-
inkscape:cy="656.46253"
|
40
|
-
inkscape:document-units="px"
|
41
|
-
inkscape:current-layer="layer1"
|
42
|
-
showgrid="false"
|
43
|
-
showguides="false"
|
44
|
-
inkscape:guide-bbox="true"
|
45
|
-
inkscape:window-width="1920"
|
46
|
-
inkscape:window-height="1056"
|
47
|
-
inkscape:window-x="1920"
|
48
|
-
inkscape:window-y="24"
|
49
|
-
inkscape:window-maximized="1">
|
50
|
-
<sodipodi:guide
|
51
|
-
orientation="1,0"
|
52
|
-
position="645.99255,757.10933"
|
53
|
-
id="guide2995" />
|
54
|
-
<sodipodi:guide
|
55
|
-
orientation="1,0"
|
56
|
-
position="488.40876,686.90373"
|
57
|
-
id="guide2997" />
|
58
|
-
<sodipodi:guide
|
59
|
-
orientation="1,0"
|
60
|
-
position="176.7767,748.52304"
|
61
|
-
id="guide2999" />
|
62
|
-
<sodipodi:guide
|
63
|
-
orientation="1,0"
|
64
|
-
position="355.71429,782.85714"
|
65
|
-
id="guide3005" />
|
66
|
-
<sodipodi:guide
|
67
|
-
orientation="0,1"
|
68
|
-
position="527.14286,642.85714"
|
69
|
-
id="guide3007" />
|
70
|
-
<sodipodi:guide
|
71
|
-
orientation="0,1"
|
72
|
-
position="431.42857,507.85714"
|
73
|
-
id="guide3009" />
|
74
|
-
<sodipodi:guide
|
75
|
-
orientation="0,1"
|
76
|
-
position="488.40876,783.57143"
|
77
|
-
id="guide3011" />
|
78
|
-
<sodipodi:guide
|
79
|
-
orientation="0,1"
|
80
|
-
position="505,372.85714"
|
81
|
-
id="guide3013" />
|
82
|
-
</sodipodi:namedview>
|
83
|
-
<metadata
|
84
|
-
id="metadata7">
|
85
|
-
<rdf:RDF>
|
86
|
-
<cc:Work
|
87
|
-
rdf:about="">
|
88
|
-
<dc:format>image/svg+xml</dc:format>
|
89
|
-
<dc:type
|
90
|
-
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
91
|
-
<dc:title></dc:title>
|
92
|
-
</cc:Work>
|
93
|
-
</rdf:RDF>
|
94
|
-
</metadata>
|
95
|
-
<g
|
96
|
-
inkscape:label="Layer 1"
|
97
|
-
inkscape:groupmode="layer"
|
98
|
-
id="layer1">
|
99
|
-
<path
|
100
|
-
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:10;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans;stroke-opacity:1;stroke-miterlimit:30;stroke-dasharray:none;stroke-linecap:round;stroke-linejoin:round"
|
101
|
-
d="m 176.28125,201.03125 0,0.625 0,395.125 0,0.375 0.34375,0.0937 312.34375,91.6875 0.625,0.1875 0,-0.65625 0.125,-419.09375 0,-0.40625 -0.40625,-0.0937 -312.4375,-67.71875 -0.59375,-0.125 z m 1,1.21875 311.4375,67.5 -0.125,418.0625 -311.3125,-91.375 0,-394.1875 z"
|
102
|
-
id="path2985"
|
103
|
-
inkscape:connector-curvature="0" />
|
104
|
-
<path
|
105
|
-
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:10;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans;stroke-opacity:1;stroke-miterlimit:30;stroke-dasharray:none;stroke-linecap:round;stroke-linejoin:round"
|
106
|
-
d="m 647.21875,206.59375 -0.6875,0.28125 -157.59375,62.21875 -0.3125,0.125 0,0.34375 0.1875,419.125 0,0.75 0.6875,-0.28125 156.0625,-63.1875 0.3125,-0.125 0,-0.34375 1.34375,-418.15625 0,-0.75 z m -1,1.4375 -1.34375,417.125 -155.0625,62.78125 -0.1875,-418.03125 156.59375,-61.875 z"
|
107
|
-
id="path2993"
|
108
|
-
inkscape:connector-curvature="0" />
|
109
|
-
<path
|
110
|
-
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:10;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans;stroke-opacity:1;stroke-miterlimit:30;stroke-dasharray:none;stroke-linecap:round;stroke-linejoin:round"
|
111
|
-
d="m 355.6875,137.40625 -0.15625,0.0625 L 176.96875,201.0625 177.3125,202 355.75,138.4375 646.78125,207.53125 647,206.5625 l -291.15625,-69.125 -0.15625,-0.0312 z"
|
112
|
-
id="path3003"
|
113
|
-
inkscape:connector-curvature="0" />
|
114
|
-
<path
|
115
|
-
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:10;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans;stroke-opacity:1;stroke-miterlimit:30;stroke-dasharray:none;stroke-linecap:round;stroke-linejoin:round"
|
116
|
-
d="m 355.71875,277.53125 -0.125,0.0312 -178.9375,47.96875 -1.8125,0.46875 1.8125,0.5 311.625,83.5 0.15625,0.0312 0.125,-0.0625 157.59375,-53.65625 1.5625,-0.53125 -1.59375,-0.4375 -290.28125,-77.78125 -0.125,-0.0312 z m 0,1.03125 L 644.3125,355.90625 488.375,409 178.71875,326 l 177,-47.4375 z"
|
117
|
-
id="path3015"
|
118
|
-
inkscape:connector-curvature="0" />
|
119
|
-
<path
|
120
|
-
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:10;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans;stroke-opacity:1;stroke-miterlimit:30;stroke-dasharray:none;stroke-linecap:round;stroke-linejoin:round"
|
121
|
-
d="m 355.21875,240.9375 0,37.125 1,0 0,-37.125 -1,0 z"
|
122
|
-
id="path3017"
|
123
|
-
inkscape:connector-curvature="0" />
|
124
|
-
<path
|
125
|
-
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:10;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans;stroke-opacity:1;stroke-miterlimit:30;stroke-dasharray:none;stroke-linecap:round;stroke-linejoin:round"
|
126
|
-
d="m 176.28125,202.65625 0,393.28125 1,0 0,-393.28125 -1,0 z"
|
127
|
-
id="path3019"
|
128
|
-
inkscape:connector-curvature="0" />
|
129
|
-
<path
|
130
|
-
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:10;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans;stroke-opacity:1;stroke-miterlimit:30;stroke-dasharray:none;stroke-linecap:round;stroke-linejoin:round"
|
131
|
-
d="m 355.71875,409 -0.125,0.0312 L 177,455.8125 l -1.78125,0.46875 1.78125,0.5 L 488.28125,545 l 0.15625,0.0312 0.125,-0.0625 156.71875,-56.25 1.46875,-0.53125 -1.53125,-0.40625 -289.375,-78.75 -0.125,-0.0312 z m 0,1.03125 287.6875,78.28125 L 488.375,544 179.03125,456.3125 355.71875,410.03125 z"
|
132
|
-
id="path3021"
|
133
|
-
inkscape:connector-curvature="0" />
|
134
|
-
<path
|
135
|
-
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:10;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans;stroke-opacity:1;stroke-miterlimit:30;stroke-dasharray:none;stroke-linecap:round;stroke-linejoin:round"
|
136
|
-
d="m 355.71875,544 -0.15625,0.0312 -178.5625,52.3125 0.28125,0.96875 178.4375,-52.28125 289.59375,80.25 0.28125,-0.96875 -289.75,-80.28125 -0.125,-0.0312 z"
|
137
|
-
id="path3023"
|
138
|
-
inkscape:connector-curvature="0" />
|
139
|
-
<path
|
140
|
-
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:10;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans;stroke-opacity:1;stroke-miterlimit:30;stroke-dasharray:none;stroke-linecap:round;stroke-linejoin:round"
|
141
|
-
d="m 355.21875,374.34375 0,35.15625 1,0 0,-35.15625 -1,0 z"
|
142
|
-
id="path3025"
|
143
|
-
inkscape:connector-curvature="0" />
|
144
|
-
<path
|
145
|
-
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:10;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans;stroke-opacity:1;stroke-miterlimit:30;stroke-dasharray:none;stroke-linecap:round;stroke-linejoin:round"
|
146
|
-
d="m 355.1875,507.03125 0,37.4375 1.03125,0 0,-37.4375 -1.03125,0 z"
|
147
|
-
id="path3027"
|
148
|
-
inkscape:connector-curvature="0" />
|
149
|
-
</g>
|
150
|
-
</svg>
|