Hello community, here is the log from the commit of package rubygem-rack for openSUSE:Factory checked in at 2017-06-08 15:02:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-rack (Old) and /work/SRC/openSUSE:Factory/.rubygem-rack.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-rack" Thu Jun 8 15:02:38 2017 rev:10 rq:501344 version:2.0.3 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-rack/rubygem-rack.changes 2017-04-11 09:30:52.858131296 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-rack.new/rubygem-rack.changes 2017-06-08 15:02:39.225981615 +0200 @@ -1,0 +2,11 @@ +Thu Jun 1 18:55:47 UTC 2017 - [email protected] + +- removed manual definition of rb_build_versions and rb_default_ruby_abi from gem2rpm.yml; recreated spec + +------------------------------------------------------------------- +Tue May 23 10:12:04 UTC 2017 - [email protected] + +- updated to version 2.0.3 + see installed HISTORY.md + +------------------------------------------------------------------- Old: ---- rack-2.0.1.gem New: ---- rack-2.0.3.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-rack.spec ++++++ --- /var/tmp/diff_new_pack.rXBH79/_old 2017-06-08 15:02:40.093859132 +0200 +++ /var/tmp/diff_new_pack.rXBH79/_new 2017-06-08 15:02:40.097858568 +0200 @@ -1,7 +1,7 @@ # # spec file for package rubygem-rack # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,14 +24,12 @@ # Name: rubygem-rack -Version: 2.0.1 +Version: 2.0.3 Release: 0 %define mod_name rack %define mod_full_name %{mod_name}-%{version} # MANUAL BuildRequires: fdupes -%define rb_build_versions ruby22 ruby23 -%define rb_default_ruby_abi ruby:2.2.0 ruby:2.3.0 # /MANUAL BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: %{ruby >= 2.2.2} @@ -39,7 +37,7 @@ BuildRequires: ruby-macros >= 5 BuildRequires: update-alternatives Url: http://rack.github.io/ -Source: http://rubygems.org/gems/%{mod_full_name}.gem +Source: https://rubygems.org/gems/%{mod_full_name}.gem Source1: rubygem-rack-rpmlintrc Source2: gem2rpm.yml Summary: A modular Ruby webserver interface ++++++ gem2rpm.yml ++++++ --- /var/tmp/diff_new_pack.rXBH79/_old 2017-06-08 15:02:40.133853488 +0200 +++ /var/tmp/diff_new_pack.rXBH79/_new 2017-06-08 15:02:40.133853488 +0200 @@ -76,8 +76,8 @@ :preamble: |- BuildRequires: fdupes - %define rb_build_versions ruby22 ruby23 - %define rb_default_ruby_abi ruby:2.2.0 ruby:2.3.0 +# %define rb_build_versions ruby22 ruby23 +# %define rb_default_ruby_abi ruby:2.2.0 ruby:2.3.0 :post_install: |- %fdupes %{buildroot}%{_libdir}/ruby/gems/*/gems/%{mod_name}-%{version}/ ++++++ rack-2.0.1.gem -> rack-2.0.3.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/SPEC new/SPEC --- old/SPEC 2016-06-30 19:34:02.000000000 +0200 +++ new/SPEC 2017-05-15 18:49:44.000000000 +0200 @@ -237,10 +237,10 @@ The lines must not contain characters below 037. === The Content-Type There must not be a <tt>Content-Type</tt>, when the +Status+ is 1xx, -204, 205 or 304. +204 or 304. === The Content-Length There must not be a <tt>Content-Length</tt> header when the -+Status+ is 1xx, 204, 205 or 304. ++Status+ is 1xx, 204 or 304. === The Body The Body must respond to +each+ and must only yield String values. Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rack/deflater.rb new/lib/rack/deflater.rb --- old/lib/rack/deflater.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/lib/rack/deflater.rb 2017-05-15 18:49:44.000000000 +0200 @@ -8,7 +8,6 @@ # Currently supported compression algorithms: # # * gzip - # * deflate # * identity (no transformation) # # The middleware automatically detects when compression is supported @@ -22,7 +21,7 @@ # [app] rack app instance # [options] hash of deflater options, i.e. # 'if' - a lambda enabling / disabling deflation based on returned boolean value - # e.g use Rack::Deflater, :if => lambda { |env, status, headers, body| body.length > 512 } + # e.g use Rack::Deflater, :if => lambda { |env, status, headers, body| body.map(&:bytesize).reduce(0, :+) > 512 } # 'include' - a list of content types that should be compressed def initialize(app, options = {}) @app = app @@ -41,7 +40,7 @@ request = Request.new(env) - encoding = Utils.select_best_encoding(%w(gzip deflate identity), + encoding = Utils.select_best_encoding(%w(gzip identity), request.accept_encoding) # Set the Vary HTTP header. @@ -57,10 +56,6 @@ mtime = headers.key?("Last-Modified") ? Time.httpdate(headers["Last-Modified"]) : Time.now [status, headers, GzipStream.new(body, mtime)] - when "deflate" - headers['Content-Encoding'] = "deflate" - headers.delete(CONTENT_LENGTH) - [status, headers, DeflateStream.new(body)] when "identity" [status, headers, body] when nil @@ -95,36 +90,6 @@ end def close - return if @closed - @closed = true - @body.close if @body.respond_to?(:close) - end - end - - class DeflateStream - DEFLATE_ARGS = [ - Zlib::DEFAULT_COMPRESSION, - # drop the zlib header which causes both Safari and IE to choke - -Zlib::MAX_WBITS, - Zlib::DEF_MEM_LEVEL, - Zlib::DEFAULT_STRATEGY - ] - - def initialize(body) - @body = body - @closed = false - end - - def each - deflator = ::Zlib::Deflate.new(*DEFLATE_ARGS) - @body.each { |part| yield deflator.deflate(part, Zlib::SYNC_FLUSH) } - yield fin = deflator.finish - ensure - deflator.finish unless fin - deflator.close - end - - def close return if @closed @closed = true @body.close if @body.respond_to?(:close) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rack/file.rb new/lib/rack/file.rb --- old/lib/rack/file.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/lib/rack/file.rb 2017-05-15 18:49:44.000000000 +0200 @@ -158,7 +158,7 @@ def filesize path # If response_body is present, use its size. - return Rack::Utils.bytesize(response_body) if response_body + return response_body.bytesize if response_body # We check via File::size? whether this file provides size info # via stat (e.g. /proc files often don't), otherwise we have to diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rack/handler/webrick.rb new/lib/rack/handler/webrick.rb --- old/lib/rack/handler/webrick.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/lib/rack/handler/webrick.rb 2017-05-15 18:49:44.000000000 +0200 @@ -86,10 +86,11 @@ status, headers, body = @app.call(env) begin res.status = status.to_i + io_lambda = nil headers.each { |k, vs| - next if k.downcase == RACK_HIJACK - - if k.downcase == "set-cookie" + if k == RACK_HIJACK + io_lambda = vs + elsif k.downcase == "set-cookie" res.cookies.concat vs.split("\n") else # Since WEBrick won't accept repeated headers, @@ -98,7 +99,6 @@ end } - io_lambda = headers[RACK_HIJACK] if io_lambda rd, wr = IO.pipe res.body = rd diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rack/lint.rb new/lib/rack/lint.rb --- old/lib/rack/lint.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/lib/rack/lint.rb 2017-05-15 18:49:44.000000000 +0200 @@ -659,7 +659,7 @@ def check_content_type(status, headers) headers.each { |key, value| ## There must not be a <tt>Content-Type</tt>, when the +Status+ is 1xx, - ## 204, 205 or 304. + ## 204 or 304. if key.downcase == "content-type" assert("Content-Type header found in #{status} response, not allowed") { not Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.include? status.to_i @@ -674,7 +674,7 @@ headers.each { |key, value| if key.downcase == 'content-length' ## There must not be a <tt>Content-Length</tt> header when the - ## +Status+ is 1xx, 204, 205 or 304. + ## +Status+ is 1xx, 204 or 304. assert("Content-Length header found in #{status} response, not allowed") { not Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.include? status.to_i } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rack/method_override.rb new/lib/rack/method_override.rb --- old/lib/rack/method_override.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/lib/rack/method_override.rb 2017-05-15 18:49:44.000000000 +0200 @@ -38,6 +38,9 @@ def method_override_param(req) req.POST[METHOD_OVERRIDE_PARAM_KEY] rescue Utils::InvalidParameterError, Utils::ParameterTypeError + req.get_header(RACK_ERRORS).puts "Invalid or incomplete POST params" + rescue EOFError + req.get_header(RACK_ERRORS).puts "Bad request content body" end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rack/mock.rb new/lib/rack/mock.rb --- old/lib/rack/mock.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/lib/rack/mock.rb 2017-05-15 18:49:44.000000000 +0200 @@ -91,13 +91,13 @@ env = DEFAULT_ENV.dup - env[REQUEST_METHOD] = opts[:method] ? opts[:method].to_s.upcase : GET - env[SERVER_NAME] = uri.host || "example.org" - env[SERVER_PORT] = uri.port ? uri.port.to_s : "80" - env[QUERY_STRING] = uri.query.to_s - env[PATH_INFO] = (!uri.path || uri.path.empty?) ? "/" : uri.path - env[RACK_URL_SCHEME] = uri.scheme || "http" - env[HTTPS] = env[RACK_URL_SCHEME] == "https" ? "on" : "off" + env[REQUEST_METHOD] = (opts[:method] ? opts[:method].to_s.upcase : GET).b + env[SERVER_NAME] = (uri.host || "example.org").b + env[SERVER_PORT] = (uri.port ? uri.port.to_s : "80").b + env[QUERY_STRING] = (uri.query.to_s).b + env[PATH_INFO] = ((!uri.path || uri.path.empty?) ? "/" : uri.path).b + env[RACK_URL_SCHEME] = (uri.scheme || "http").b + env[HTTPS] = (env[RACK_URL_SCHEME] == "https" ? "on" : "off").b env[SCRIPT_NAME] = opts[:script_name] || "" @@ -190,7 +190,7 @@ end def empty? - [201, 204, 205, 304].include? status + [201, 204, 304].include? status end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rack/multipart/parser.rb new/lib/rack/multipart/parser.rb --- old/lib/rack/multipart/parser.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/lib/rack/multipart/parser.rb 2017-05-15 18:49:44.000000000 +0200 @@ -8,7 +8,7 @@ BUFSIZE = 16384 TEXT_PLAIN = "text/plain" TEMPFILE_FACTORY = lambda { |filename, content_type| - Tempfile.new(["RackMultipart", ::File.extname(filename)]) + Tempfile.new(["RackMultipart", ::File.extname(filename.gsub("\0".freeze, '%00'.freeze))]) } class BoundedIO # :nodoc: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rack/request.rb new/lib/rack/request.rb --- old/lib/rack/request.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/lib/rack/request.rb 2017-05-15 18:49:44.000000000 +0200 @@ -422,7 +422,7 @@ # shortcut for <tt>request.params[key]</tt> def [](key) - if $verbose + if $VERBOSE warn("Request#[] is deprecated and will be removed in a future version of Rack. Please use request.params[] instead") end @@ -433,7 +433,7 @@ # # Note that modifications will not be persisted in the env. Use update_param or delete_param if you want to destructively modify params. def []=(key, value) - if $verbose + if $VERBOSE warn("Request#[]= is deprecated and will be removed in a future version of Rack. Please use request.params[]= instead") end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rack/response.rb new/lib/rack/response.rb --- old/lib/rack/response.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/lib/rack/response.rb 2017-05-15 18:49:44.000000000 +0200 @@ -60,7 +60,7 @@ def finish(&block) @block = block - if [204, 205, 304].include?(status.to_i) + if [204, 304].include?(status.to_i) delete_header CONTENT_TYPE delete_header CONTENT_LENGTH close diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rack/server.rb new/lib/rack/server.rb --- old/lib/rack/server.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/lib/rack/server.rb 2017-05-15 18:49:44.000000000 +0200 @@ -1,4 +1,5 @@ require 'optparse' +require 'fileutils' module Rack @@ -359,7 +360,7 @@ def write_pid ::File.open(options[:pid], ::File::CREAT | ::File::EXCL | ::File::WRONLY ){ |f| f.write("#{Process.pid}") } - at_exit { ::File.delete(options[:pid]) if ::File.exist?(options[:pid]) } + at_exit { ::FileUtils.rm_f(options[:pid]) } rescue Errno::EEXIST check_pid! retry diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rack/session/abstract/id.rb new/lib/rack/session/abstract/id.rb --- old/lib/rack/session/abstract/id.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/lib/rack/session/abstract/id.rb 2017-05-15 18:49:44.000000000 +0200 @@ -18,6 +18,8 @@ include Enumerable attr_writer :id + Unspecified = Object.new + def self.find(req) req.get_header RACK_SESSION end @@ -54,7 +56,15 @@ load_for_read! @data[key.to_s] end - alias :fetch :[] + + def fetch(key, default=Unspecified, &block) + load_for_read! + if default == Unspecified + @data.fetch(key.to_s, &block) + else + @data.fetch(key.to_s, default, &block) + end + end def has_key?(key) load_for_read! @@ -167,7 +177,7 @@ # * :key determines the name of the cookie, by default it is # 'rack.session' # * :path, :domain, :expire_after, :secure, and :httponly set the related - # cookie options as by Rack::Response#add_cookie + # cookie options as by Rack::Response#set_cookie # * :skip will not a set a cookie in the response nor update the session state # * :defer will not set a cookie in the response but still update the session # state if it is used with a backend @@ -200,7 +210,7 @@ :sidbits => 128, :cookie_only => true, :secure_random => ::SecureRandom - } + }.freeze attr_reader :key, :default_options, :sid_secure @@ -398,7 +408,7 @@ class ID < Persisted def self.inherited(klass) - k = klass.ancestors.find { |kl| kl.superclass == ID } + k = klass.ancestors.find { |kl| kl.respond_to?(:superclass) && kl.superclass == ID } unless k.instance_variable_defined?(:"@_rack_warned") warn "#{klass} is inheriting from #{ID}. Inheriting from #{ID} is deprecated, please inherit from #{Persisted} instead" if $VERBOSE k.instance_variable_set(:"@_rack_warned", true) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rack/utils.rb new/lib/rack/utils.rb --- old/lib/rack/utils.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/lib/rack/utils.rb 2017-05-15 18:49:44.000000000 +0200 @@ -576,7 +576,7 @@ } # Responses with HTTP status codes that should not have an entity body - STATUS_WITH_NO_ENTITY_BODY = Set.new((100..199).to_a << 204 << 205 << 304) + STATUS_WITH_NO_ENTITY_BODY = Set.new((100..199).to_a << 204 << 304) SYMBOL_TO_STATUS_CODE = Hash[*HTTP_STATUS_CODES.map { |code, message| [message.downcase.gsub(/\s|-|'/, '_').to_sym, code] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/rack.rb new/lib/rack.rb --- old/lib/rack.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/lib/rack.rb 2017-05-15 18:49:44.000000000 +0200 @@ -18,7 +18,7 @@ VERSION.join(".") end - RELEASE = "2.0.1" + RELEASE = "2.0.3" # Return the Rack release as a dotted string. def self.release diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2016-06-30 19:34:02.000000000 +0200 +++ new/metadata 2017-05-15 18:49:44.000000000 +0200 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: rack version: !ruby/object:Gem::Version - version: 2.0.1 + version: 2.0.3 platform: ruby authors: - Christian Neukirchen autorequire: bindir: bin cert_chain: [] -date: 2016-06-30 00:00:00.000000000 Z +date: 2017-05-15 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: minitest @@ -191,6 +191,7 @@ - test/multipart/filename_with_encoded_words - test/multipart/filename_with_escaped_quotes - test/multipart/filename_with_escaped_quotes_and_modification_param +- test/multipart/filename_with_null_byte - test/multipart/filename_with_percent_escaped_quotes - test/multipart/filename_with_single_quote - test/multipart/filename_with_unescaped_percentages @@ -288,7 +289,7 @@ version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.6.6 +rubygems_version: 2.6.8 signing_key: specification_version: 4 summary: a modular Ruby webserver interface @@ -344,4 +345,3 @@ - test/spec_utils.rb - test/spec_version.rb - test/spec_webrick.rb -has_rdoc: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/multipart/filename_with_null_byte new/test/multipart/filename_with_null_byte --- old/test/multipart/filename_with_null_byte 1970-01-01 01:00:00.000000000 +0100 +++ new/test/multipart/filename_with_null_byte 2017-05-15 18:49:44.000000000 +0200 @@ -0,0 +1,7 @@ +--AaB03x +Content-Type: image/jpeg +Content-Disposition: attachment; name="files"; filename="flowers.exe%00.jpg" +Content-Description: a complete map of the human genome + +contents +--AaB03x-- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/spec_chunked.rb new/test/spec_chunked.rb --- old/test/spec_chunked.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/test/spec_chunked.rb 2017-05-15 18:49:44.000000000 +0200 @@ -92,7 +92,7 @@ body.join.must_equal 'Hello World!' end - [100, 204, 205, 304].each do |status_code| + [100, 204, 304].each do |status_code| it "not modify response when status code is #{status_code}" do app = lambda { |env| [status_code, {}, []] } status, headers, _ = chunked(app).call(@env) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/spec_content_length.rb new/test/spec_content_length.rb --- old/test/spec_content_length.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/test/spec_content_length.rb 2017-05-15 18:49:44.000000000 +0200 @@ -36,13 +36,13 @@ it "not set Content-Length on 304 responses" do app = lambda { |env| [304, {}, []] } response = content_length(app).call(request) - response[1]['Content-Length'].must_equal nil + response[1]['Content-Length'].must_be_nil end it "not set Content-Length when Transfer-Encoding is chunked" do app = lambda { |env| [200, {'Content-Type' => 'text/plain', 'Transfer-Encoding' => 'chunked'}, []] } response = content_length(app).call(request) - response[1]['Content-Length'].must_equal nil + response[1]['Content-Length'].must_be_nil end # Using "Connection: close" for this is fairly contended. It might be useful @@ -51,7 +51,7 @@ # should "not force a Content-Length when Connection:close" do # app = lambda { |env| [200, {'Connection' => 'close'}, []] } # response = content_length(app).call({}) - # response[1]['Content-Length'].must_equal nil + # response[1]['Content-Length'].must_be_nil # end it "close bodies that need to be closed" do @@ -64,7 +64,7 @@ app = lambda { |env| [200, {'Content-Type' => 'text/plain'}, body] } response = content_length(app).call(request) - body.closed.must_equal nil + body.closed.must_be_nil response[2].close body.closed.must_equal true end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/spec_content_type.rb new/test/spec_content_type.rb --- old/test/spec_content_type.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/test/spec_content_type.rb 2017-05-15 18:49:44.000000000 +0200 @@ -41,6 +41,6 @@ it "not set Content-Type on 304 responses" do app = lambda { |env| [304, {}, []] } response = content_type(app, "text/html").call(request) - response[1]['Content-Type'].must_equal nil + response[1]['Content-Type'].must_be_nil end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/spec_deflater.rb new/test/spec_deflater.rb --- old/test/spec_deflater.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/test/spec_deflater.rb 2017-05-15 18:49:44.000000000 +0200 @@ -81,13 +81,22 @@ yield(status, headers, body) if block_given? end + # automatic gzip detection (streamable) + def auto_inflater + Zlib::Inflate.new(32 + Zlib::MAX_WBITS) + end + + def deflate_or_gzip + {'deflate, gzip' => 'gzip'} + end + it 'be able to deflate bodies that respond to each' do app_body = Object.new class << app_body; def each; yield('foo'); yield('bar'); end; end - verify(200, 'foobar', 'deflate', { 'app_body' => app_body }) do |status, headers, body| + verify(200, 'foobar', deflate_or_gzip, { 'app_body' => app_body }) do |status, headers, body| headers.must_equal({ - 'Content-Encoding' => 'deflate', + 'Content-Encoding' => 'gzip', 'Vary' => 'Accept-Encoding', 'Content-Type' => 'text/plain' }) @@ -98,15 +107,15 @@ app_body = Object.new class << app_body; def each; yield('foo'); yield('bar'); end; end - verify(200, app_body, 'deflate', { 'skip_body_verify' => true }) do |status, headers, body| + verify(200, app_body, deflate_or_gzip, { 'skip_body_verify' => true }) do |status, headers, body| headers.must_equal({ - 'Content-Encoding' => 'deflate', + 'Content-Encoding' => 'gzip', 'Vary' => 'Accept-Encoding', 'Content-Type' => 'text/plain' }) buf = [] - inflater = Zlib::Inflate.new(-Zlib::MAX_WBITS) + inflater = auto_inflater body.each { |part| buf << inflater.inflate(part) } buf << inflater.finish @@ -118,32 +127,33 @@ app_body = Object.new class << app_body; def each; yield('foo'); yield('bar'); end; end opts = { 'skip_body_verify' => true } - verify(200, app_body, 'deflate', opts) do |status, headers, body| + verify(200, app_body, 'gzip', opts) do |status, headers, body| headers.must_equal({ - 'Content-Encoding' => 'deflate', + 'Content-Encoding' => 'gzip', 'Vary' => 'Accept-Encoding', 'Content-Type' => 'text/plain' }) buf = [] - inflater = Zlib::Inflate.new(-Zlib::MAX_WBITS) + inflater = auto_inflater FakeDisconnect = Class.new(RuntimeError) assert_raises(FakeDisconnect, "not Zlib::DataError not raised") do body.each do |part| - buf << inflater.inflate(part) + tmp = inflater.inflate(part) + buf << tmp if tmp.bytesize > 0 raise FakeDisconnect end end - assert_raises(Zlib::BufError) { inflater.finish } + inflater.finish buf.must_equal(%w(foo)) end end # TODO: This is really just a special case of the above... it 'be able to deflate String bodies' do - verify(200, 'Hello world!', 'deflate') do |status, headers, body| + verify(200, 'Hello world!', deflate_or_gzip) do |status, headers, body| headers.must_equal({ - 'Content-Encoding' => 'deflate', + 'Content-Encoding' => 'gzip', 'Vary' => 'Accept-Encoding', 'Content-Type' => 'text/plain' }) @@ -280,7 +290,7 @@ 'Content-Encoding' => 'identity' } } - verify(200, 'Hello World!', 'deflate', options) + verify(200, 'Hello World!', deflate_or_gzip, options) end it "deflate if content-type matches :include" do @@ -334,7 +344,7 @@ :if => lambda { |env, status, headers, body| true } } } - verify(200, 'Hello World!', 'deflate', options) + verify(200, 'Hello World!', deflate_or_gzip, options) end it "not deflate if :if lambda evaluates to false" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/spec_etag.rb new/test/spec_etag.rb --- old/test/spec_etag.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/test/spec_etag.rb 2017-05-15 18:49:44.000000000 +0200 @@ -58,7 +58,7 @@ it "not set Cache-Control if directive isn't present" do app = lambda { |env| [200, {'Content-Type' => 'text/plain'}, ["Hello, World!"]] } response = etag(app, nil, nil).call(request) - response[1]['Cache-Control'].must_equal nil + response[1]['Cache-Control'].must_be_nil end it "not change ETag if it is already set" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/spec_file.rb new/test/spec_file.rb --- old/test/spec_file.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/test/spec_file.rb 2017-05-15 18:49:44.000000000 +0200 @@ -184,8 +184,8 @@ status, heads, _ = file(DOCROOT).call(env) status.must_equal 200 - heads['Cache-Control'].must_equal nil - heads['Access-Control-Allow-Origin'].must_equal nil + heads['Cache-Control'].must_be_nil + heads['Access-Control-Allow-Origin'].must_be_nil end it "only support GET, HEAD, and OPTIONS requests" do @@ -239,7 +239,7 @@ req = Rack::MockRequest.new(Rack::Lint.new(Rack::File.new(DOCROOT, nil, nil))) res = req.get "/cgi/test" res.must_be :successful? - res['Content-Type'].must_equal nil + res['Content-Type'].must_be_nil end it "return error when file not found for head request" do @@ -248,4 +248,17 @@ res.body.must_be :empty? end + class MyFile < Rack::File + def response_body + "hello world" + end + end + + it "behaves gracefully if response_body is present" do + file = Rack::Lint.new MyFile.new(DOCROOT) + res = Rack::MockRequest.new(file).get("/cgi/test") + + res.must_be :ok? + end + end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/spec_lint.rb new/test/spec_lint.rb --- old/test/spec_lint.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/test/spec_lint.rb 2017-05-15 18:49:44.000000000 +0200 @@ -269,7 +269,7 @@ # }.must_raise(Rack::Lint::LintError). # message.must_match(/No Content-Type/) - [100, 101, 204, 205, 304].each do |status| + [100, 101, 204, 304].each do |status| lambda { Rack::Lint.new(lambda { |env| [status, {"Content-type" => "text/plain", "Content-length" => "0"}, []] @@ -280,7 +280,7 @@ end it "notice content-length errors" do - [100, 101, 204, 205, 304].each do |status| + [100, 101, 204, 304].each do |status| lambda { Rack::Lint.new(lambda { |env| [status, {"Content-length" => "0"}, []] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/spec_media_type.rb new/test/spec_media_type.rb --- old/test/spec_media_type.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/test/spec_media_type.rb 2017-05-15 18:49:44.000000000 +0200 @@ -8,7 +8,7 @@ before { @content_type = nil } it '#type is nil' do - Rack::MediaType.type(@content_type).must_equal nil + Rack::MediaType.type(@content_type).must_be_nil end it '#params is empty' do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/spec_method_override.rb new/test/spec_method_override.rb --- old/test/spec_method_override.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/test/spec_method_override.rb 2017-05-15 18:49:44.000000000 +0200 @@ -66,14 +66,27 @@ "CONTENT_TYPE" => "multipart/form-data, boundary=AaB03x", "CONTENT_LENGTH" => input.size.to_s, :method => "POST", :input => input) - begin - app.call env - rescue EOFError - end + app.call env env["REQUEST_METHOD"].must_equal "POST" end + it "writes error to RACK_ERRORS when given invalid multipart form data" do + input = <<EOF +--AaB03x\r +content-disposition: form-data; name="huge"; filename="huge"\r +EOF + env = Rack::MockRequest.env_for("/", + "CONTENT_TYPE" => "multipart/form-data, boundary=AaB03x", + "CONTENT_LENGTH" => input.size.to_s, + Rack::RACK_ERRORS => StringIO.new, + :method => "POST", :input => input) + Rack::MethodOverride.new(proc { [200, {"Content-Type" => "text/plain"}, []] }).call env + + env[Rack::RACK_ERRORS].rewind + env[Rack::RACK_ERRORS].read.must_match /Bad request content body/ + end + it "not modify REQUEST_METHOD for POST requests when the params are unparseable" do env = Rack::MockRequest.env_for("/", :method => "POST", :input => "(%bad-params%)") app.call env diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/spec_mime.rb new/test/spec_mime.rb --- old/test/spec_mime.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/test/spec_mime.rb 2017-05-15 18:49:44.000000000 +0200 @@ -19,7 +19,7 @@ end it "should support null fallbacks" do - Rack::Mime.mime_type('.nothing', nil).must_equal nil + Rack::Mime.mime_type('.nothing', nil).must_be_nil end it "should match exact mimes" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/spec_mock.rb new/test/spec_mock.rb --- old/test/spec_mock.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/test/spec_mock.rb 2017-05-15 18:49:44.000000000 +0200 @@ -211,6 +211,23 @@ Rack::MockRequest.new(capp).get('/', :lint => true) called.must_equal true end + + it "defaults encoding to ASCII 8BIT" do + req = Rack::MockRequest.env_for("/foo") + + keys = [ + Rack::REQUEST_METHOD, + Rack::SERVER_NAME, + Rack::SERVER_PORT, + Rack::QUERY_STRING, + Rack::PATH_INFO, + Rack::HTTPS, + Rack::RACK_URL_SCHEME + ] + keys.each do |k| + assert_equal Encoding::ASCII_8BIT, req[k].encoding + end + end end describe Rack::MockResponse do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/spec_multipart.rb new/test/spec_multipart.rb --- old/test/spec_multipart.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/test/spec_multipart.rb 2017-05-15 18:49:44.000000000 +0200 @@ -27,7 +27,7 @@ it "return nil if content type is not multipart" do env = Rack::MockRequest.env_for("/", "CONTENT_TYPE" => 'application/x-www-form-urlencoded') - Rack::Multipart.parse_multipart(env).must_equal nil + Rack::Multipart.parse_multipart(env).must_be_nil end it "parse multipart content when content type present but filename is not" do @@ -305,11 +305,17 @@ params["files"][:filename].must_equal "bob's flowers.jpg" end + it "parse multipart form with a null byte in the filename" do + env = Rack::MockRequest.env_for '/', multipart_fixture(:filename_with_null_byte) + params = Rack::Multipart.parse_multipart(env) + params["files"][:filename].must_equal "flowers.exe\u0000.jpg" + end + it "not include file params if no file was selected" do env = Rack::MockRequest.env_for("/", multipart_fixture(:none)) params = Rack::Multipart.parse_multipart(env) params["submit-name"].must_equal "Larry" - params["files"].must_equal nil + params["files"].must_be_nil params.keys.wont_include "files" end @@ -557,7 +563,7 @@ it "return nil if no UploadedFiles were used" do data = Rack::Multipart.build_multipart("people" => [{"submit-name" => "Larry", "files" => "contents"}]) - data.must_equal nil + data.must_be_nil end it "raise ArgumentError if params is not a Hash" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/spec_request.rb new/test/spec_request.rb --- old/test/spec_request.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/test/spec_request.rb 2017-05-15 18:49:44.000000000 +0200 @@ -476,7 +476,7 @@ req = make_request \ Rack::MockRequest.env_for("/") - req.referer.must_equal nil + req.referer.must_be_nil end it "extract user agent correctly" do @@ -486,25 +486,25 @@ req = make_request \ Rack::MockRequest.env_for("/") - req.user_agent.must_equal nil + req.user_agent.must_be_nil end it "treat missing content type as nil" do req = make_request \ Rack::MockRequest.env_for("/") - req.content_type.must_equal nil + req.content_type.must_be_nil end it "treat empty content type as nil" do req = make_request \ Rack::MockRequest.env_for("/", "CONTENT_TYPE" => "") - req.content_type.must_equal nil + req.content_type.must_be_nil end it "return nil media type for empty content type" do req = make_request \ Rack::MockRequest.env_for("/", "CONTENT_TYPE" => "") - req.media_type.must_equal nil + req.media_type.must_be_nil end it "cache, but invalidates the cache" do @@ -1296,13 +1296,13 @@ req.trusted_proxy?('unix').must_equal 0 req.trusted_proxy?('unix:/tmp/sock').must_equal 0 - req.trusted_proxy?("unix.example.org").must_equal nil - req.trusted_proxy?("example.org\n127.0.0.1").must_equal nil - req.trusted_proxy?("127.0.0.1\nexample.org").must_equal nil - req.trusted_proxy?("11.0.0.1").must_equal nil - req.trusted_proxy?("172.15.0.1").must_equal nil - req.trusted_proxy?("172.32.0.1").must_equal nil - req.trusted_proxy?("2001:470:1f0b:18f8::1").must_equal nil + req.trusted_proxy?("unix.example.org").must_be_nil + req.trusted_proxy?("example.org\n127.0.0.1").must_be_nil + req.trusted_proxy?("127.0.0.1\nexample.org").must_be_nil + req.trusted_proxy?("11.0.0.1").must_be_nil + req.trusted_proxy?("172.15.0.1").must_be_nil + req.trusted_proxy?("172.32.0.1").must_be_nil + req.trusted_proxy?("2001:470:1f0b:18f8::1").must_be_nil end it "sets the default session to an empty hash" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/spec_response.rb new/test/spec_response.rb --- old/test/spec_response.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/test/spec_response.rb 2017-05-15 18:49:44.000000000 +0200 @@ -55,7 +55,7 @@ it "can set and read headers" do response = Rack::Response.new - response["Content-Type"].must_equal nil + response["Content-Type"].must_be_nil response["Content-Type"] = "text/plain" response["Content-Type"].must_equal "text/plain" end @@ -273,8 +273,8 @@ _, header, body = r.finish str = ""; body.each { |part| str << part } str.must_be :empty? - header["Content-Type"].must_equal nil - header['Content-Length'].must_equal nil + header["Content-Type"].must_be_nil + header['Content-Length'].must_be_nil lambda { Rack::Response.new(Object.new) @@ -410,7 +410,7 @@ res.body.must_be :closed? end - it "calls close on #body when 204, 205, or 304" do + it "calls close on #body when 204 or 304" do res = Rack::Response.new res.body = StringIO.new res.finish @@ -424,7 +424,7 @@ res.body = StringIO.new res.status = 205 _, _, b = res.finish - res.body.must_be :closed? + res.body.wont_be :closed? b.wont_equal res.body res.body = StringIO.new diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/spec_server.rb new/test/spec_server.rb --- old/test/spec_server.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/test/spec_server.rb 2017-05-15 18:49:44.000000000 +0200 @@ -77,7 +77,7 @@ o, ENV["REQUEST_METHOD"] = ENV["REQUEST_METHOD"], 'foo' server = Rack::Server.new(:app => 'foo') server.server.name =~ /CGI/ - Rack::Server.logging_middleware.call(server).must_equal nil + Rack::Server.logging_middleware.call(server).must_be_nil ensure ENV['REQUEST_METHOD'] = o end @@ -85,7 +85,7 @@ it "be quiet if said so" do server = Rack::Server.new(:app => "FOO", :quiet => true) - Rack::Server.logging_middleware.call(server).must_equal nil + Rack::Server.logging_middleware.call(server).must_be_nil end it "use a full path to the pidfile" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/spec_session_abstract_session_hash.rb new/test/spec_session_abstract_session_hash.rb --- old/test/spec_session_abstract_session_hash.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/test/spec_session_abstract_session_hash.rb 2017-05-15 18:49:44.000000000 +0200 @@ -25,4 +25,21 @@ assert_equal [:bar, :qux], hash.values end + describe "#fetch" do + it "returns value for a matching key" do + assert_equal :bar, hash.fetch(:foo) + end + + it "works with a default value" do + assert_equal :default, hash.fetch(:unknown, :default) + end + + it "works with a block" do + assert_equal :default, hash.fetch(:unkown) { :default } + end + + it "it raises when fetching unknown keys without defaults" do + lambda { hash.fetch(:unknown) }.must_raise KeyError + end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/spec_session_cookie.rb new/test/spec_session_cookie.rb --- old/test/spec_session_cookie.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/test/spec_session_cookie.rb 2017-05-15 18:49:44.000000000 +0200 @@ -98,18 +98,18 @@ it 'rescues failures on decode' do coder = Rack::Session::Cookie::Base64::Marshal.new - coder.decode('lulz').must_equal nil + coder.decode('lulz').must_be_nil end end describe 'JSON' do - it 'marshals and base64 encodes' do + it 'JSON and base64 encodes' do coder = Rack::Session::Cookie::Base64::JSON.new obj = %w[fuuuuu] coder.encode(obj).must_equal [::JSON.dump(obj)].pack('m') end - it 'marshals and base64 decodes' do + it 'JSON and base64 decodes' do coder = Rack::Session::Cookie::Base64::JSON.new str = [::JSON.dump(%w[fuuuuu])].pack('m') coder.decode(str).must_equal ::JSON.parse(str.unpack('m').first) @@ -117,7 +117,7 @@ it 'rescues failures on decode' do coder = Rack::Session::Cookie::Base64::JSON.new - coder.decode('lulz').must_equal nil + coder.decode('lulz').must_be_nil end end @@ -139,7 +139,7 @@ it 'rescues failures on decode' do coder = Rack::Session::Cookie::Base64::ZipJSON.new - coder.decode('lulz').must_equal nil + coder.decode('lulz').must_be_nil end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/spec_session_memcache.rb new/test/spec_session_memcache.rb --- old/test/spec_session_memcache.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/test/spec_session_memcache.rb 2017-05-15 18:49:44.000000000 +0200 @@ -143,7 +143,7 @@ res1.body.must_equal '{"counter"=>1}' res2 = dreq.get("/", "HTTP_COOKIE" => cookie) - res2["Set-Cookie"].must_equal nil + res2["Set-Cookie"].must_be_nil res2.body.must_equal '{"counter"=>2}' res3 = req.get("/", "HTTP_COOKIE" => cookie) @@ -183,7 +183,7 @@ creq = Rack::MockRequest.new(count) res0 = dreq.get("/") - res0["Set-Cookie"].must_equal nil + res0["Set-Cookie"].must_be_nil res0.body.must_equal '{"counter"=>1}' res0 = creq.get("/") @@ -201,7 +201,7 @@ creq = Rack::MockRequest.new(count) res0 = sreq.get("/") - res0["Set-Cookie"].must_equal nil + res0["Set-Cookie"].must_be_nil res0.body.must_equal '{"counter"=>1}' res0 = creq.get("/") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/spec_session_pool.rb new/test/spec_session_pool.rb --- old/test/spec_session_pool.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/test/spec_session_pool.rb 2017-05-15 18:49:45.000000000 +0200 @@ -138,7 +138,7 @@ dreq = Rack::MockRequest.new(defer) res1 = dreq.get("/") - res1["Set-Cookie"].must_equal nil + res1["Set-Cookie"].must_be_nil res1.body.must_equal '{"counter"=>1}' pool.pool.size.must_equal 1 end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/spec_static.rb new/test/spec_static.rb --- old/test/spec_static.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/test/spec_static.rb 2017-05-15 18:49:45.000000000 +0200 @@ -97,7 +97,7 @@ it "serves regular files if client accepts gzip encoding and gzip files are not present" do res = @gzip_request.get("/cgi/rackup_stub.rb", 'HTTP_ACCEPT_ENCODING'=>'deflate, gzip') res.must_be :ok? - res.headers['Content-Encoding'].must_equal nil + res.headers['Content-Encoding'].must_be_nil res.headers['Content-Type'].must_equal 'text/x-script.ruby' res.body.must_match(/ruby/) end @@ -105,7 +105,7 @@ it "serves regular files if client does not accept gzip encoding" do res = @gzip_request.get("/cgi/test") res.must_be :ok? - res.headers['Content-Encoding'].must_equal nil + res.headers['Content-Encoding'].must_be_nil res.headers['Content-Type'].must_equal 'text/plain' res.body.must_match(/ruby/) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/spec_utils.rb new/test/spec_utils.rb --- old/test/spec_utils.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/test/spec_utils.rb 2017-05-15 18:49:45.000000000 +0200 @@ -394,7 +394,7 @@ Rack::Utils.best_q_match("text/plain,text/html", %w[text/html text/plain]).must_equal "text/html" # When there are no matches, return nil: - Rack::Utils.best_q_match("application/json", %w[text/html text/plain]).must_equal nil + Rack::Utils.best_q_match("application/json", %w[text/html text/plain]).must_be_nil end it "escape html entities [&><'\"/]" do @@ -427,9 +427,9 @@ Rack::Utils.select_best_encoding(a, b) end - helper.call(%w(), [["x", 1]]).must_equal nil - helper.call(%w(identity), [["identity", 0.0]]).must_equal nil - helper.call(%w(identity), [["*", 0.0]]).must_equal nil + helper.call(%w(), [["x", 1]]).must_be_nil + helper.call(%w(identity), [["identity", 0.0]]).must_be_nil + helper.call(%w(identity), [["*", 0.0]]).must_be_nil helper.call(%w(identity), [["compress", 1.0], ["gzip", 1.0]]).must_equal "identity" @@ -538,15 +538,15 @@ describe Rack::Utils, "byte_range" do it "ignore missing or syntactically invalid byte ranges" do - Rack::Utils.byte_ranges({},500).must_equal nil - Rack::Utils.byte_ranges({"HTTP_RANGE" => "foobar"},500).must_equal nil - Rack::Utils.byte_ranges({"HTTP_RANGE" => "furlongs=123-456"},500).must_equal nil - Rack::Utils.byte_ranges({"HTTP_RANGE" => "bytes="},500).must_equal nil - Rack::Utils.byte_ranges({"HTTP_RANGE" => "bytes=-"},500).must_equal nil - Rack::Utils.byte_ranges({"HTTP_RANGE" => "bytes=123,456"},500).must_equal nil + Rack::Utils.byte_ranges({},500).must_be_nil + Rack::Utils.byte_ranges({"HTTP_RANGE" => "foobar"},500).must_be_nil + Rack::Utils.byte_ranges({"HTTP_RANGE" => "furlongs=123-456"},500).must_be_nil + Rack::Utils.byte_ranges({"HTTP_RANGE" => "bytes="},500).must_be_nil + Rack::Utils.byte_ranges({"HTTP_RANGE" => "bytes=-"},500).must_be_nil + Rack::Utils.byte_ranges({"HTTP_RANGE" => "bytes=123,456"},500).must_be_nil # A range of non-positive length is syntactically invalid and ignored: - Rack::Utils.byte_ranges({"HTTP_RANGE" => "bytes=456-123"},500).must_equal nil - Rack::Utils.byte_ranges({"HTTP_RANGE" => "bytes=456-455"},500).must_equal nil + Rack::Utils.byte_ranges({"HTTP_RANGE" => "bytes=456-123"},500).must_be_nil + Rack::Utils.byte_ranges({"HTTP_RANGE" => "bytes=456-455"},500).must_be_nil end it "parse simple byte ranges" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/spec_webrick.rb new/test/spec_webrick.rb --- old/test/spec_webrick.rb 2016-06-30 19:34:02.000000000 +0200 +++ new/test/spec_webrick.rb 2017-05-15 18:49:45.000000000 +0200 @@ -1,5 +1,6 @@ require 'minitest/autorun' require 'rack/mock' +require 'concurrent/utility/native_integer' require 'concurrent/atomic/count_down_latch' require File.expand_path('../testrequest', __FILE__) @@ -171,7 +172,7 @@ Rack::Lint.new(lambda{ |req| [ 200, - {"rack.hijack" => io_lambda}, + [ [ "rack.hijack", io_lambda ] ], [""] ] }) @@ -195,7 +196,7 @@ Net::HTTP.start(@host, @port){ |http| res = http.get("/chunked") res["Transfer-Encoding"].must_equal "chunked" - res["Content-Length"].must_equal nil + res["Content-Length"].must_be_nil res.body.must_equal "chunked" } end
