Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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]
8 changes: 1 addition & 7 deletions lib/rack/adapter/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
4 changes: 3 additions & 1 deletion lib/thin/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
39 changes: 9 additions & 30 deletions lib/thin/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/thin/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
19 changes: 3 additions & 16 deletions lib/thin/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -25,8 +16,4 @@ def self.win?
def self.linux?
RUBY_PLATFORM =~ /linux/
end

def self.ruby_18?
RUBY_VERSION =~ /^1\.8/
end
end
2 changes: 1 addition & 1 deletion rakelib/announce.rake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ task :ann do

body = <<END_OF_MESSAGE
To: #{SEND_TO.join(', ')}
Subject: [ANN] Thin #{Thin::VERSION::STRING} #{Thin::VERSION::CODENAME} release
Subject: [ANN] Thin #{Thin::VERSION} #{Thin::CODENAME} release

#{msg}
END_OF_MESSAGE
Expand Down
2 changes: 1 addition & 1 deletion rakelib/email.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Hey,

Thin version <%= Thin::VERSION::STRING %> (codename <%= Thin::VERSION::CODENAME %>) is out!
Thin version <%= Thin::VERSION %> (codename <%= Thin::CODENAME %>) is out!

== What's new?

Expand Down
7 changes: 2 additions & 5 deletions thin.gemspec
Original file line number Diff line number Diff line change
@@ -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"
Expand Down