diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index 582cae52..4a328ff3 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -43,7 +43,7 @@ module Sinatra body = [body] if body.respond_to? :to_str if body.respond_to?(:to_ary) header["Content-Length"] = body.to_ary. - inject(0) { |len, part| len + part.bytesize }.to_s + inject(0) { |len, part| len + Rack::Utils.bytesize(part) }.to_s end [status.to_i, header.to_hash, body] end @@ -1106,13 +1106,3 @@ module Sinatra Default.helpers(*extensions, &block) end end - -class String #:nodoc: - # Define String#each under 1.9 for Rack compatibility. This should be - # removed once Rack is fully 1.9 compatible. - alias_method :each, :each_line unless ''.respond_to? :each - - # Define String#bytesize as an alias to String#length for Ruby 1.8.6 and - # earlier. - alias_method :bytesize, :length unless ''.respond_to? :bytesize -end diff --git a/sinatra.gemspec b/sinatra.gemspec index ae50f1f7..10f8aae3 100644 --- a/sinatra.gemspec +++ b/sinatra.gemspec @@ -112,7 +112,7 @@ Gem::Specification.new do |s| s.test_files = s.files.select {|path| path =~ /^test\/.*_test.rb/} s.extra_rdoc_files = %w[README.rdoc LICENSE] - s.add_dependency 'rack', '>= 0.9.1' + s.add_dependency 'rack', '>= 1.0' s.add_development_dependency 'shotgun', '>= 0.2', '< 1.0' s.add_development_dependency 'rack-test', '>= 0.3.0'