about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/unicorn.rb4
-rw-r--r--lib/unicorn/http_request.rb2
-rw-r--r--lib/unicorn/http_response.rb3
-rw-r--r--local.mk.sample2
-rw-r--r--test/unit/test_server.rb10
5 files changed, 18 insertions, 3 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index 69ecf33..7a1ef34 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -250,6 +250,10 @@ module Unicorn
     def stdout_path=(path); redirect_io($stdout, path); end
     def stderr_path=(path); redirect_io($stderr, path); end
 
+    def logger=(obj)
+      HttpRequest::DEFAULTS["rack.logger"] = super
+    end
+
     # sets the path for the PID file of the master process
     def pid=(path)
       if path
diff --git a/lib/unicorn/http_request.rb b/lib/unicorn/http_request.rb
index 31fcc3d..99c11c2 100644
--- a/lib/unicorn/http_request.rb
+++ b/lib/unicorn/http_request.rb
@@ -12,7 +12,7 @@ module Unicorn
       "rack.multiprocess" => true,
       "rack.multithread" => false,
       "rack.run_once" => false,
-      "rack.version" => [1, 0],
+      "rack.version" => [1, 1],
       "SCRIPT_NAME" => "",
 
       # this is not in the Rack spec, but some apps may rely on it
diff --git a/lib/unicorn/http_response.rb b/lib/unicorn/http_response.rb
index 92d4d6d..96e484b 100644
--- a/lib/unicorn/http_response.rb
+++ b/lib/unicorn/http_response.rb
@@ -47,7 +47,8 @@ module Unicorn
         headers.each do |key, value|
           next if SKIP.include?(key.downcase)
           if value =~ /\n/
-            out.concat(value.split(/\n/).map! { |v| "#{key}: #{v}\r\n" })
+            # avoiding blank, key-only cookies with /\n+/
+            out.concat(value.split(/\n+/).map! { |v| "#{key}: #{v}\r\n" })
           else
             out << "#{key}: #{value}\r\n"
           end
diff --git a/local.mk.sample b/local.mk.sample
index c2054ce..5019576 100644
--- a/local.mk.sample
+++ b/local.mk.sample
@@ -5,7 +5,7 @@
 # This is depends on a bunch of GNU-isms from bash, sed, touch.
 
 DLEXT := so
-gems := rack-1.0.1
+gems := rack-1.1.0
 
 # Avoid loading rubygems to speed up tests because gmake is
 # fork+exec heavy with Ruby.
diff --git a/test/unit/test_server.rb b/test/unit/test_server.rb
index 55147b7..00705d0 100644
--- a/test/unit/test_server.rb
+++ b/test/unit/test_server.rb
@@ -228,6 +228,16 @@ class WebServerTest < Test::Unit::TestCase
     end
   end
 
+  def test_logger_set
+    assert_equal @server.logger, Unicorn::HttpRequest::DEFAULTS["rack.logger"]
+  end
+
+  def test_logger_changed
+    tmp = Logger.new($stdout)
+    @server.logger = tmp
+    assert_equal tmp, Unicorn::HttpRequest::DEFAULTS["rack.logger"]
+  end
+
   def test_bad_client_400
     sock = nil
     assert_nothing_raised do