unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* more house-cleaning for unicorn 5
@ 2014-08-17  2:33 Eric Wong
  2014-08-17  2:33 ` [PATCH 1/3] dev: remove isolate dependency Eric Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Wong @ 2014-08-17  2:33 UTC (permalink / raw)
  To: unicorn-public

The only user-visible change would be the removal of the Status:
header from the HTTP response, but I doubt anybody would even
notice.

Eric Wong (3):
      dev: remove isolate dependency
      unicorn.gemspec: depend on test-unit 3.0
      http_response: remove Status: header

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] dev: remove isolate dependency
  2014-08-17  2:33 more house-cleaning for unicorn 5 Eric Wong
@ 2014-08-17  2:33 ` Eric Wong
  2014-08-17  2:33 ` [PATCH 2/3] unicorn.gemspec: depend on test-unit 3.0 Eric Wong
  2014-08-17  2:33 ` [PATCH 3/3] http_response: remove Status: header Eric Wong
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2014-08-17  2:33 UTC (permalink / raw)
  To: unicorn-public

It seems unnecessary with current versions of RubyGems
supporting development dependencies.
---
 GNUmakefile              |  6 +-----
 script/isolate_for_tests | 31 -------------------------------
 t/GNUmakefile            |  6 +-----
 unicorn.gemspec          |  1 -
 4 files changed, 2 insertions(+), 42 deletions(-)
 delete mode 100755 script/isolate_for_tests

diff --git a/GNUmakefile b/GNUmakefile
index 00a6ace..50819fc 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -23,11 +23,7 @@ endif
 
 RUBY_ENGINE := $(shell $(RUBY) -e 'puts((RUBY_ENGINE rescue "ruby"))')
 
-isolate_libs := tmp/isolate/$(RUBY_ENGINE)-$(RUBY_VERSION).mk
-$(isolate_libs): script/isolate_for_tests
-	@$(RUBY) script/isolate_for_tests
--include $(isolate_libs)
-MYLIBS = $(RUBYLIB):$(ISOLATE_LIBS)
+MYLIBS = $(RUBYLIB)
 
 # dunno how to implement this as concisely in Ruby, and hell, I love awk
 awk_slow := awk '/def test_/{print FILENAME"--"$$2".n"}' 2>/dev/null
diff --git a/script/isolate_for_tests b/script/isolate_for_tests
deleted file mode 100755
index 6f5dced..0000000
--- a/script/isolate_for_tests
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env ruby
-# scripts/Makefiles can read and eval the output of this script and
-# use it as RUBYLIB
-require 'rubygems'
-require 'isolate'
-fp = File.open(__FILE__, "rb")
-fp.flock(File::LOCK_EX)
-
-ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
-opts = {
-  :system => false,
-  # we want "ruby-1.8.7" and not "ruby-1.8", so disable :multiruby
-  :multiruby => false,
-  :path => "tmp/isolate/#{ruby_engine}-#{RUBY_VERSION}",
-}
-
-pid = fork do
-  Isolate.now!(opts) do
-    gem 'raindrops', '0.13.0'
-    gem 'kgio', '2.9.2'
-    gem 'rack', '1.5.2'
-  end
-end
-_, status = Process.waitpid2(pid)
-status.success? or abort status.inspect
-lib_paths = Dir["#{opts[:path]}/gems/*-*/lib"].map { |x| File.expand_path(x) }
-dst = "tmp/isolate/#{ruby_engine}-#{RUBY_VERSION}.mk"
-File.open("#{dst}.#$$", "w") do |fp|
-  fp.puts "ISOLATE_LIBS=#{lib_paths.join(':')}"
-end
-File.rename("#{dst}.#$$", dst)
diff --git a/t/GNUmakefile b/t/GNUmakefile
index 8f2668c..5f5d9bc 100644
--- a/t/GNUmakefile
+++ b/t/GNUmakefile
@@ -17,11 +17,7 @@ endif
 RUBY_ENGINE := $(shell $(RUBY) -e 'puts((RUBY_ENGINE rescue "ruby"))')
 export RUBY_ENGINE
 
-isolate_libs := ../tmp/isolate/$(RUBY_ENGINE)-$(RUBY_VERSION).mk
-$(isolate_libs): ../script/isolate_for_tests
-	@cd .. && $(RUBY) script/isolate_for_tests
--include $(isolate_libs)
-MYLIBS := $(RUBYLIB):$(ISOLATE_LIBS)
+MYLIBS := $(RUBYLIB)
 
 T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
 
diff --git a/unicorn.gemspec b/unicorn.gemspec
index c0c8092..b24b1ac 100644
--- a/unicorn.gemspec
+++ b/unicorn.gemspec
@@ -37,7 +37,6 @@ Gem::Specification.new do |s|
   s.add_dependency(%q<kgio>, '~> 2.6')
   s.add_dependency(%q<raindrops>, '~> 0.7')
 
-  s.add_development_dependency('isolate', '~> 3.2')
   s.add_development_dependency('wrongdoc', '~> 1.8')
 
   s.licenses = ["GPLv2+", "Ruby 1.8"]
-- 
EW


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] unicorn.gemspec: depend on test-unit 3.0
  2014-08-17  2:33 more house-cleaning for unicorn 5 Eric Wong
  2014-08-17  2:33 ` [PATCH 1/3] dev: remove isolate dependency Eric Wong
@ 2014-08-17  2:33 ` Eric Wong
  2014-08-17  2:33 ` [PATCH 3/3] http_response: remove Status: header Eric Wong
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2014-08-17  2:33 UTC (permalink / raw)
  To: unicorn-public; +Cc: Ken Dreyer

test-unit 3 and minitest 5 will have equal support status as a
bundled gems when Ruby 2.2.0 is released in December 2014.  These
bundled gems will appear in the user-oriented tarball installations,
but do not get installed by "make install" when installing Ruby
from SVN or git.

test-unit appears to be actively maintained and good at keeping
backwards compatibility even on a major version change, so this
means no code changes on our end.  I am not convinced switching to
minitest is worth the effort.

Cc: Ken Dreyer <ktdreyer@ktdreyer.com>
---
 unicorn.gemspec | 1 +
 1 file changed, 1 insertion(+)

diff --git a/unicorn.gemspec b/unicorn.gemspec
index b24b1ac..9456db2 100644
--- a/unicorn.gemspec
+++ b/unicorn.gemspec
@@ -37,6 +37,7 @@ Gem::Specification.new do |s|
   s.add_dependency(%q<kgio>, '~> 2.6')
   s.add_dependency(%q<raindrops>, '~> 0.7')
 
+  s.add_development_dependency('test-unit', '~> 3.0')
   s.add_development_dependency('wrongdoc', '~> 1.8')
 
   s.licenses = ["GPLv2+", "Ruby 1.8"]
-- 
EW


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] http_response: remove Status: header
  2014-08-17  2:33 more house-cleaning for unicorn 5 Eric Wong
  2014-08-17  2:33 ` [PATCH 1/3] dev: remove isolate dependency Eric Wong
  2014-08-17  2:33 ` [PATCH 2/3] unicorn.gemspec: depend on test-unit 3.0 Eric Wong
@ 2014-08-17  2:33 ` Eric Wong
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2014-08-17  2:33 UTC (permalink / raw)
  To: unicorn-public

Whatever compatibility reasons which existed in 2009 likely do not exist
now.  Other servers (e.g. thin, puma) seem to work alright without it,
so there's no reason to waste precious bytes.
---
 lib/unicorn/http_response.rb | 4 +---
 test/unit/test_response.rb   | 6 ------
 2 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/lib/unicorn/http_response.rb b/lib/unicorn/http_response.rb
index 083951c..cc027c5 100644
--- a/lib/unicorn/http_response.rb
+++ b/lib/unicorn/http_response.rb
@@ -24,14 +24,12 @@ module Unicorn::HttpResponse
   # writes the rack_response to socket as an HTTP response
   def http_response_write(socket, status, headers, body,
                           response_start_sent=false)
-    status = CODES[status.to_i] || status
     hijack = nil
 
     http_response_start = response_start_sent ? '' : 'HTTP/1.1 '
     if headers
-      buf = "#{http_response_start}#{status}\r\n" \
+      buf = "#{http_response_start}#{CODES[status.to_i] || status}\r\n" \
             "Date: #{httpdate}\r\n" \
-            "Status: #{status}\r\n" \
             "Connection: close\r\n"
       headers.each do |key, value|
         case key
diff --git a/test/unit/test_response.rb b/test/unit/test_response.rb
index 85ac085..fcddc5e 100644
--- a/test/unit/test_response.rb
+++ b/test/unit/test_response.rb
@@ -38,7 +38,6 @@ class ResponseTest < Test::Unit::TestCase
     http_response_write(out,'200', {}, [])
     assert ! out.closed?
     assert out.length > 0, "output didn't have data"
-    assert_equal 1, out.string.split(/\r\n/).grep(/^Status: 200 OK/).size
   end
 
   def test_response_200
@@ -71,7 +70,6 @@ class ResponseTest < Test::Unit::TestCase
     out = StringIO.new
     http_response_write(out,200, {"X-Whatever" => "stuff"}, [])
     assert ! out.closed?
-    assert_equal 1, out.string.split(/\r\n/).grep(/^Status: 200 OK/i).size
   end
 
   def test_body_closed
@@ -91,9 +89,5 @@ class ResponseTest < Test::Unit::TestCase
     assert ! out.closed?
     headers = out.string.split(/\r\n\r\n/).first.split(/\r\n/)
     assert %r{\AHTTP/\d\.\d 666 I AM THE BEAST\z}.match(headers[0])
-    status = headers.grep(/\AStatus:/i).first
-    assert status
-    assert_equal "Status: 666 I AM THE BEAST", status
   end
-
 end
-- 
EW


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-08-17  2:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-17  2:33 more house-cleaning for unicorn 5 Eric Wong
2014-08-17  2:33 ` [PATCH 1/3] dev: remove isolate dependency Eric Wong
2014-08-17  2:33 ` [PATCH 2/3] unicorn.gemspec: depend on test-unit 3.0 Eric Wong
2014-08-17  2:33 ` [PATCH 3/3] http_response: remove Status: header Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).