diff --git a/CHANGELOG b/CHANGELOG index d14a69cb..f459bce1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +== 2.0.0 + * Partial Rack 3 support. Full bi-directional streaming is not supported due to limitations in the implementation. + == 1.8.2 Ruby Razor * Ruby 3.2 support. diff --git a/Rakefile b/Rakefile index 208cc428..d1f2bb7e 100644 --- a/Rakefile +++ b/Rakefile @@ -18,5 +18,5 @@ task :install => :build do sh "gem install thin-*.gem" end -desc "Release version #{Thin::VERSION::STRING}" +desc "Release version #{Thin::VERSION}" task :release => [:tag, :push] diff --git a/lib/rack/adapter/rails.rb b/lib/rack/adapter/rails.rb index 31113e20..323b5547 100644 --- a/lib/rack/adapter/rails.rb +++ b/lib/rack/adapter/rails.rb @@ -126,13 +126,7 @@ def header(options = 'text/html') @output_cookies.each { |c| cookies << c.to_s } if @output_cookies - @response['Set-Cookie'] = [@response['Set-Cookie'], cookies].compact - # See http://groups.google.com/group/rack-devel/browse_thread/thread/e8759b91a82c5a10/a8dbd4574fe97d69?#a8dbd4574fe97d69 - if Thin.ruby_18? - @response['Set-Cookie'].flatten! - else - @response['Set-Cookie'] = @response['Set-Cookie'].join("\n") - end + @response['Set-Cookie'] = [@response['Set-Cookie'], cookies].compact.join("\n") end options.each { |k, v| @response[k] = v } diff --git a/lib/thin/env.rb b/lib/thin/env.rb index add0700a..42569a0a 100644 --- a/lib/thin/env.rb +++ b/lib/thin/env.rb @@ -15,9 +15,11 @@ def self.with_defaults(env) private class Rack2 + RACK_VERSION = [1, 0].freeze + def self.env { - ::Thin::Request::RACK_VERSION => ::Thin::VERSION::RACK, + ::Thin::Request::RACK_VERSION => RACK_VERSION, ::Thin::Request::RACK_MULTITHREAD => false, ::Thin::Request::RACK_MULTIPROCESS => false, ::Thin::Request::RACK_RUN_ONCE => false diff --git a/lib/thin/response.rb b/lib/thin/response.rb index f5ff806e..49f127fb 100644 --- a/lib/thin/response.rb +++ b/lib/thin/response.rb @@ -92,36 +92,15 @@ def head "HTTP/1.1 #{@status} #{HTTP_STATUS_CODES[@status.to_i]}\r\n#{headers_output}\r\n" end - if Thin.ruby_18? - - # Ruby 1.8 implementation. - # Respects Rack specs. - # - # See http://rack.rubyforge.org/doc/files/SPEC.html - def headers=(key_value_pairs) - key_value_pairs.each do |k, vs| - vs.each { |v| @headers[k] = v.chomp } if vs - end if key_value_pairs - end - - else - - # Ruby 1.9 doesn't have a String#each anymore. - # Rack spec doesn't take care of that yet, for now we just use - # +each+ but fallback to +each_line+ on strings. - # I wish we could remove that condition. - # To be reviewed when a new Rack spec comes out. - def headers=(key_value_pairs) - key_value_pairs.each do |k, vs| - next unless vs - if vs.is_a?(String) - vs.each_line { |v| @headers[k] = v.chomp } - else - vs.each { |v| @headers[k] = v.chomp } - end - end if key_value_pairs - end - + def headers=(key_value_pairs) + key_value_pairs.each do |k, vs| + next unless vs + if vs.is_a?(String) + vs.each_line { |v| @headers[k] = v.chomp } + else + vs.each { |v| @headers[k] = v.chomp } + end + end if key_value_pairs end # Close any resource used by the response diff --git a/lib/thin/server.rb b/lib/thin/server.rb index 295c7f41..1251ec7d 100644 --- a/lib/thin/server.rb +++ b/lib/thin/server.rb @@ -152,7 +152,7 @@ def self.start(*args, &block) def start raise ArgumentError, 'app required' unless @app - log_info "Thin web server (v#{VERSION::STRING} codename #{VERSION::CODENAME})" + log_info "Thin web server (v#{VERSION} codename #{CODENAME})" log_debug "Debugging ON" trace "Tracing ON" diff --git a/lib/thin/version.rb b/lib/thin/version.rb index 7e1da968..204a21ce 100644 --- a/lib/thin/version.rb +++ b/lib/thin/version.rb @@ -3,20 +3,11 @@ module Thin # current platform. class PlatformNotSupported < RuntimeError; end - module VERSION #:nodoc: - MAJOR = 1 - MINOR = 8 - TINY = 2 - - STRING = [MAJOR, MINOR, TINY].join('.') - - CODENAME = "Ruby Razor".freeze - - RACK = [1, 0].freeze # Rack protocol version - end + VERSION = "2.0.0" + CODENAME = "Thinception".freeze NAME = 'thin'.freeze - SERVER = "#{NAME} #{VERSION::STRING} codename #{VERSION::CODENAME}".freeze + SERVER = "#{NAME} #{VERSION} codename #{CODENAME}".freeze def self.win? RUBY_PLATFORM =~ /mswin|mingw/ @@ -25,8 +16,4 @@ def self.win? def self.linux? RUBY_PLATFORM =~ /linux/ end - - def self.ruby_18? - RUBY_VERSION =~ /^1\.8/ - end end diff --git a/rakelib/announce.rake b/rakelib/announce.rake index b5e848ba..a4a9c106 100644 --- a/rakelib/announce.rake +++ b/rakelib/announce.rake @@ -9,7 +9,7 @@ task :ann do body = < (codename <%= Thin::VERSION::CODENAME %>) is out! +Thin version <%= Thin::VERSION %> (codename <%= Thin::CODENAME %>) is out! == What's new? diff --git a/thin.gemspec b/thin.gemspec index 6c2a50c1..5a864e53 100644 --- a/thin.gemspec +++ b/thin.gemspec @@ -1,12 +1,9 @@ -$:.push File.expand_path("../lib", __FILE__) - -# Maintain your gem's version: -require "thin/version" +require_relative "lib/thin/version" # Describe your gem and declare its dependencies: Thin::GemSpec ||= Gem::Specification.new do |s| s.name = Thin::NAME - s.version = Thin::VERSION::STRING + s.version = Thin::VERSION s.platform = Thin.win? ? Gem::Platform::CURRENT : Gem::Platform::RUBY s.summary = "A thin and fast web server" s.author = "Marc-Andre Cournoyer"