rack 1.6.0.beta2 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rack might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 67268c360a9006f4c63b876a1dff3d8f4dfbdc51
4
- data.tar.gz: 394f5b04b57657f9fe03bbd84ea1d81bb6a438e5
3
+ metadata.gz: 942ed8704e37c2a93a99fe47fe5402122dbbacc3
4
+ data.tar.gz: 8a52005b33ac3863b001ea56350b65b50c74b8a0
5
5
  SHA512:
6
- metadata.gz: ff862d5cdcb4a71aecd2d94d4774ddf116cc0b94e5b07e5833d14928605b61c845103bcd8cc1638c69d8fb3ce1e4a2a2d39f7a896b3940b1adce960a276fae3f
7
- data.tar.gz: e96164e1ee85b7d08e16fa2b80d6913f17161847e53eec50f9a8e745833b867c641798ab0857d3a055c6e3cb4ef8ee7094dbd19090a06a6e2c47a45cec636f1d
6
+ metadata.gz: f7a7414780bc2acadb7b8fc479ea7087c1b93ce0a1d82649dccd33caef7d8fe3eaba5f4188fe58baa3b889331ed29ac584b13b11572dc6ec5dc0844f73f9c2fe
7
+ data.tar.gz: 6eb24f229ef6aa6db52dfc04d2c519be8a4e89c2010d3c0f1d89a50b4973c7eafd07819c1d0ab961a10ee9e063174c76374b2bb3f1a52865458750a5ef7263b1
@@ -181,6 +181,34 @@ Installing the Ruby fcgi gem:
181
181
  Furthermore, to test Memcache sessions, you need memcached (will be
182
182
  run on port 11211) and memcache-client installed.
183
183
 
184
+ == Configuration
185
+
186
+ Several parameters can be modified on `Rack::Utils` to configure Rack behaviour.
187
+
188
+ e.g:
189
+
190
+ ```ruby
191
+ Rack::Utils.key_space_limit = 128
192
+ ```
193
+
194
+ === key_space_limit
195
+
196
+ The default number of bytes to allow a single parameter key to take up.
197
+ This helps prevent a rogue client from flooding a Request.
198
+
199
+ Default to 65536 characters (4 kiB in worst case).
200
+
201
+ === multipart_part_limit
202
+
203
+ The maximum number of parts a request can contain.
204
+ Accepting too many part can lead to the server running out of file handles.
205
+
206
+ The default is `128`, which mean that a single request can't upload more than 128 files at once.
207
+
208
+ Set to `0` for not limit.
209
+
210
+ Can also be set via the `RACK_MULTIPART_PART_LIMIT` environment variable.
211
+
184
212
  == History
185
213
 
186
214
  * March 3rd, 2007: First public release 0.1.
data/Rakefile CHANGED
@@ -32,7 +32,7 @@ task :officialrelease do
32
32
  end
33
33
 
34
34
  task :officialrelease_really => %w[SPEC dist gem] do
35
- sh "sha1sum #{release}.tar.gz #{release}.gem"
35
+ sh "shasum #{release}.tar.gz #{release}.gem"
36
36
  end
37
37
 
38
38
  def release
data/SPEC CHANGED
@@ -176,20 +176,16 @@ The error stream must respond to +puts+, +write+ and +flush+.
176
176
  If rack.hijack? is true then rack.hijack must respond to #call.
177
177
  rack.hijack must return the io that will also be assigned (or is
178
178
  already present, in rack.hijack_io.
179
-
180
179
  rack.hijack_io must respond to:
181
180
  <tt>read, write, read_nonblock, write_nonblock, flush, close,
182
181
  close_read, close_write, closed?</tt>
183
-
184
182
  The semantics of these IO methods must be a best effort match to
185
183
  those of a normal ruby IO or Socket object, using standard
186
184
  arguments and raising standard exceptions. Servers are encouraged
187
185
  to simply pass on real IO objects, although it is recognized that
188
186
  this approach is not directly compatible with SPDY and HTTP 2.0.
189
-
190
187
  IO provided in rack.hijack_io should preference the
191
188
  IO::WaitReadable and IO::WaitWritable APIs wherever supported.
192
-
193
189
  There is a deliberate lack of full specification around
194
190
  rack.hijack_io, as semantics will change from server to server.
195
191
  Users are encouraged to utilize this API with a knowledge of their
@@ -197,9 +193,7 @@ server choice, and servers may extend the functionality of
197
193
  hijack_io to provide additional features to users. The purpose of
198
194
  rack.hijack is for Rack to "get out of the way", as such, Rack only
199
195
  provides the minimum of specification and support.
200
-
201
196
  If rack.hijack? is false, then rack.hijack should not be set.
202
-
203
197
  If rack.hijack? is false, then rack.hijack_io should not be set.
204
198
  ==== Response (after headers)
205
199
  It is also possible to hijack a response after the status and headers
@@ -208,7 +202,6 @@ In order to do this, an application may set the special header
208
202
  <tt>rack.hijack</tt> to an object that responds to <tt>call</tt>
209
203
  accepting an argument that conforms to the <tt>rack.hijack_io</tt>
210
204
  protocol.
211
-
212
205
  After the headers have been sent, and this hijack callback has been
213
206
  called, the application is now responsible for the remaining lifecycle
214
207
  of the IO. The application is also responsible for maintaining HTTP
@@ -217,10 +210,8 @@ applications will have wanted to specify the header Connection:close in
217
210
  HTTP/1.1, and not Connection:keep-alive, as there is no protocol for
218
211
  returning hijacked sockets to the web server. For that purpose, use the
219
212
  body streaming API instead (progressively yielding strings via each).
220
-
221
213
  Servers must ignore the <tt>body</tt> part of the response tuple when
222
214
  the <tt>rack.hijack</tt> response API is in use.
223
-
224
215
  The special response header <tt>rack.hijack</tt> must only be set
225
216
  if the request env has <tt>rack.hijack?</tt> <tt>true</tt>.
226
217
  ==== Conventions
@@ -238,9 +229,9 @@ The header must respond to +each+, and yield values of key and value.
238
229
  Special headers starting "rack." are for communicating with the
239
230
  server, and must not be sent back to the client.
240
231
  The header keys must be Strings.
241
- The header must not contain a +Status+ key,
242
- contain keys with <tt>:</tt> or newlines in their name,
243
- but only contain keys that match the token rule according to RFC 2616.
232
+ The header must not contain a +Status+ key.
233
+ The header must conform to RFC7230 token specification, i.e. cannot
234
+ contain non-printable ASCII, DQUOTE or "(),/:;<=>?@[\]{}".
244
235
  The values of the header must be Strings,
245
236
  consisting of lines (for multiple header values, e.g. multiple
246
237
  <tt>Set-Cookie</tt> values) separated by "\\n".
@@ -11,7 +11,7 @@
11
11
 
12
12
  module Rack
13
13
  # The Rack protocol version number implemented.
14
- VERSION = [1,2]
14
+ VERSION = [1,3]
15
15
 
16
16
  # Return the Rack protocol version as a dotted string.
17
17
  def self.version
@@ -635,12 +635,11 @@ module Rack
635
635
  assert("header key must be a string, was #{key.class}") {
636
636
  key.kind_of? String
637
637
  }
638
- ## The header must not contain a +Status+ key,
638
+ ## The header must not contain a +Status+ key.
639
639
  assert("header must not contain Status") { key.downcase != "status" }
640
- ## contain keys with <tt>:</tt> or newlines in their name,
641
- assert("header names must not contain : or \\n") { key !~ /[:\n]/ }
642
- ## The header must match the token rule according to RFC 2616
643
- assert("invalid header name: #{key}") { key =~ /\A[\!#\$%&'\*\+-.0-9A-Z\^_`a-z\|~]+\z/ }
640
+ ## The header must conform to RFC7230 token specification, i.e. cannot
641
+ ## contain non-printable ASCII, DQUOTE or "(),/:;<=>?@[\]{}".
642
+ assert("invalid header name: #{key}") { key !~ /[\(\),\/:;<=>\?@\[\\\]{}[[:cntrl:]]]/ }
644
643
 
645
644
  ## The values of the header must be Strings,
646
645
  assert("a header value must be a String, but the value of " +
@@ -68,7 +68,7 @@ module Rack
68
68
  # This helps prevent a rogue client from flooding a Request.
69
69
  self.key_space_limit = 65536
70
70
 
71
- # The maximum number of parts a request can contain. Accepting to many part
71
+ # The maximum number of parts a request can contain. Accepting too many part
72
72
  # can lead to the server running out of file handles.
73
73
  # Set to `0` for no limit.
74
74
  self.multipart_part_limit = (ENV['RACK_MULTIPART_LIMIT'] || 128).to_i
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "rack"
3
- s.version = "1.6.0.beta2"
3
+ s.version = "1.6.0"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.summary = "a modular Ruby webserver interface"
6
6
  s.license = "MIT"
@@ -200,19 +200,36 @@ describe Rack::Lint do
200
200
  }.should.raise(Rack::Lint::LintError).
201
201
  message.should.match(/must not contain Status/)
202
202
 
203
- lambda {
204
- Rack::Lint.new(lambda { |env|
205
- [200, {"Content-Type:" => "text/plain"}, []]
206
- }).call(env({}))
207
- }.should.raise(Rack::Lint::LintError).
208
- message.should.match(/must not contain :/)
209
-
210
- lambda {
211
- Rack::Lint.new(lambda { |env|
212
- [200, {"([{<quark>}])?" => "text/plain"}, []]
213
- }).call(env({}))
214
- }.should.raise(Rack::Lint::LintError).
215
- message.should.equal("invalid header name: ([{<quark>}])?")
203
+ # From RFC 7230:<F24><F25>
204
+ # Most HTTP header field values are defined using common syntax
205
+ # components (token, quoted-string, and comment) separated by
206
+ # whitespace or specific delimiting characters. Delimiters are chosen
207
+ # from the set of US-ASCII visual characters not allowed in a token
208
+ # (DQUOTE and "(),/:;<=>?@[\]{}").
209
+ #
210
+ # token = 1*tchar
211
+ #
212
+ # tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
213
+ # / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
214
+ # / DIGIT / ALPHA
215
+ # ; any VCHAR, except delimiters
216
+ invalid_headers = 0.upto(31).map(&:chr) + %W<( ) , / : ; < = > ? @ [ \\ ] { } \x7F>
217
+ invalid_headers.each do |invalid_header|
218
+ lambda {
219
+ Rack::Lint.new(lambda { |env|
220
+ [200, {invalid_header => "text/plain"}, []]
221
+ }).call(env({}))
222
+ }.should.raise(Rack::Lint::LintError, "on invalid header: #{invalid_header}").
223
+ message.should.equal("invalid header name: #{invalid_header}")
224
+ end
225
+ valid_headers = 0.upto(127).map(&:chr) - invalid_headers
226
+ valid_headers.each do |valid_header|
227
+ lambda {
228
+ Rack::Lint.new(lambda { |env|
229
+ [200, {valid_header => "text/plain"}, []]
230
+ }).call(env({}))
231
+ }.should.not.raise(Rack::Lint::LintError, "on valid header: #{valid_header}")
232
+ end
216
233
 
217
234
  lambda {
218
235
  Rack::Lint.new(lambda { |env|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0.beta2
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Neukirchen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-27 00:00:00.000000000 Z
11
+ date: 2014-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bacon
@@ -246,12 +246,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
246
246
  version: '0'
247
247
  required_rubygems_version: !ruby/object:Gem::Requirement
248
248
  requirements:
249
- - - ">"
249
+ - - ">="
250
250
  - !ruby/object:Gem::Version
251
- version: 1.3.1
251
+ version: '0'
252
252
  requirements: []
253
253
  rubyforge_project: rack
254
- rubygems_version: 2.2.2
254
+ rubygems_version: 2.4.5
255
255
  signing_key:
256
256
  specification_version: 4
257
257
  summary: a modular Ruby webserver interface