a647a23
--- Rakefile.debug	2010-01-07 03:03:57.000000000 +0900
f073f4b
+++ Rakefile	2010-01-28 00:43:00.000000000 +0900
a647a23
@@ -80,7 +80,7 @@
a647a23
   s.requirements << 'none'
a647a23
 
f073f4b
   s.add_dependency('activesupport', '= 2.3.5' + PKG_BUILD)
a647a23
-  s.add_dependency('rack', '~> 1.0.0')
a647a23
+  s.add_dependency('rack', '>= 1.0.0')
a647a23
 
a647a23
   s.require_path = 'lib'
a647a23
   s.autorequire = 'action_controller'
a647a23
--- lib/action_controller.rb.debug	2010-01-07 03:03:57.000000000 +0900
f073f4b
+++ lib/action_controller.rb	2010-01-28 00:43:00.000000000 +0900
a647a23
@@ -31,7 +31,7 @@
a647a23
   end
a647a23
 end
a647a23
 
f073f4b
-gem 'rack', '~> 1.0.1'
f073f4b
+gem 'rack', '>= 1.0.1'
a647a23
 require 'rack'
f073f4b
 require 'action_controller/cgi_ext'
a647a23
 
a647a23
--- lib/action_controller/integration.rb.debug	2010-01-07 03:03:57.000000000 +0900
a647a23
+++ lib/action_controller/integration.rb	2010-01-07 18:46:03.000000000 +0900
a647a23
@@ -320,9 +320,25 @@
a647a23
 
a647a23
           @headers = Rack::Utils::HeaderHash.new(headers)
a647a23
 
a647a23
-          (@headers['Set-Cookie'] || "").split("\n").each do |cookie|
a647a23
-            name, value = cookie.match(/^([^=]*)=([^;]*);/)[1,2]
a647a23
-            @cookies[name] = value
a647a23
+          # Umm.. it seems that with rack 1.1.0 @headers is an array
a647a23
+          # instead of a string which rack 1.0.0 returned
a647a23
+          # FIXME!!
a647a23
+
a647a23
+          headers_cookie = @headers['Set-Cookie']
a647a23
+          if headers_cookie.is_a?(Array)
a647a23
+              headers_cookie.each do |cookie_arr|
a647a23
+                cookie_arr.split("\n").each do |cookie|
a647a23
+                  name, value = cookie.match(/^([^=]*)=([^;]*);/)[1,2]
a647a23
+                  @cookies[name] = value
a647a23
+                end
a647a23
+              end
a647a23
+
a647a23
+          else
a647a23
+
a647a23
+            (headers_cookie || "").split("\n").each do |cookie|
a647a23
+              name, value = cookie.match(/^([^=]*)=([^;]*);/)[1,2]
a647a23
+              @cookies[name] = value
a647a23
+            end
a647a23
           end
a647a23
 
a647a23
           @body = ""
a647a23
--- lib/action_controller/response.rb.debug	2010-01-07 03:03:57.000000000 +0900
a647a23
+++ lib/action_controller/response.rb	2010-01-07 19:40:44.000000000 +0900
a647a23
@@ -112,6 +112,12 @@
a647a23
     end
a647a23
 
a647a23
     def etag?
a647a23
+
a647a23
+      # FIXME!!
a647a23
+      if Rack::VERSION[0] == 1 && Rack::VERSION[1] >= 1
a647a23
+        return headers.include?('ETag') && !headers['ETag'].nil?
a647a23
+      end
a647a23
+
a647a23
       headers.include?('ETag')
a647a23
     end
a647a23
 
a647a23
@@ -218,8 +224,15 @@
a647a23
       # Don't set the Content-Length for block-based bodies as that would mean
a647a23
       # reading it all into memory. Not nice for, say, a 2GB streaming file.
a647a23
       def set_content_length!
a647a23
+
a647a23
+        ## FIXME
a647a23
+
a647a23
         if status && status.to_s[0..2] == '204'
a647a23
           headers.delete('Content-Length')
a647a23
+
a647a23
+        elsif Rack::VERSION[0] == 1 && Rack::VERSION[1] >= 1 && status && status.to_s[0..2] == '304'
a647a23
+          headers.delete('Content-Length')
a647a23
+
a647a23
         elsif length = headers['Content-Length']
a647a23
           headers['Content-Length'] = length.to_s
a647a23
         elsif !body.respond_to?(:call) && (!status || status.to_s[0..2] != '304')
a647a23
--- test/controller/integration_test.rb.debug	2010-01-07 03:03:57.000000000 +0900
a647a23
+++ test/controller/integration_test.rb	2010-01-07 05:44:37.000000000 +0900
a647a23
@@ -306,7 +306,9 @@
a647a23
       assert_equal "Gone", status_message
a647a23
       assert_response 410
a647a23
       assert_response :gone
a647a23
-      assert_equal "cookie_1=; path=/\ncookie_3=chocolate; path=/", headers["Set-Cookie"]
a647a23
+      # Okay if cookies coincides.
a647a23
+      # With rake 1.1.0 headers["Set-Cookie"] is an array instread of a string
a647a23
+      #assert_equal "cookie_1=; path=/\ncookie_3=chocolate; path=/", headers["Set-Cookie"]
a647a23
       assert_equal({"cookie_1"=>"", "cookie_2"=>"oatmeal", "cookie_3"=>"chocolate"}, cookies)
a647a23
       assert_equal "Gone", response.body
a647a23
     end
a647a23
--- test/controller/rack_test.rb.debug	2010-01-07 03:03:57.000000000 +0900
a647a23
+++ test/controller/rack_test.rb	2010-01-07 05:40:49.000000000 +0900
a647a23
@@ -215,11 +215,16 @@
a647a23
 
a647a23
     status, headers, body = @response.to_a
a647a23
     assert_equal 200, status
a647a23
+    if headers['Set-Cookie'].is_a?(Array)
a647a23
+      cookie_must = []
a647a23
+    else
a647a23
+      cookie_must = ""
a647a23
+    end
a647a23
     assert_equal({
a647a23
       "Content-Type" => "text/html; charset=utf-8",
a647a23
       "Cache-Control" => "private, max-age=0, must-revalidate",
a647a23
       "ETag" => '"65a8e27d8879283831b664bd8b7f0ad4"',
a647a23
-      "Set-Cookie" => "",
a647a23
+      "Set-Cookie" => cookie_must,
a647a23
       "Content-Length" => "13"
a647a23
     }, headers)
a647a23
 
a647a23
@@ -234,11 +239,16 @@
a647a23
 
a647a23
     status, headers, body = @response.to_a
a647a23
     assert_equal 200, status
a647a23
+    if headers['Set-Cookie'].is_a?(Array)
a647a23
+      cookie_must = []
a647a23
+    else
a647a23
+      cookie_must = ""
a647a23
+    end
a647a23
     assert_equal({
a647a23
       "Content-Type" => "text/html; charset=utf-8",
a647a23
       "Cache-Control" => "private, max-age=0, must-revalidate",
a647a23
       "ETag" => '"ebb5e89e8a94e9dd22abf5d915d112b2"',
a647a23
-      "Set-Cookie" => "",
a647a23
+      "Set-Cookie" => cookie_must,
a647a23
       "Content-Length" => "8"
a647a23
     }, headers)
a647a23
   end
a647a23
@@ -251,10 +261,15 @@
a647a23
 
a647a23
     status, headers, body = @response.to_a
a647a23
     assert_equal 200, status
a647a23
+    if headers['Set-Cookie'].is_a?(Array)
a647a23
+      cookie_must = []
a647a23
+    else
a647a23
+      cookie_must = ""
a647a23
+    end
a647a23
     assert_equal({
a647a23
       "Content-Type" => "text/html; charset=utf-8",
a647a23
       "Cache-Control" => "no-cache",
a647a23
-      "Set-Cookie" => ""
a647a23
+      "Set-Cookie" => cookie_must
a647a23
     }, headers)
a647a23
 
a647a23
     parts = []
a647a23
--- test/controller/session/cookie_store_test.rb.debug	2010-01-07 03:03:57.000000000 +0900
a647a23
+++ test/controller/session/cookie_store_test.rb	2010-01-07 05:47:37.000000000 +0900
a647a23
@@ -145,7 +145,8 @@
a647a23
     with_test_route_set do
a647a23
       get '/no_session_access'
a647a23
       assert_response :success
a647a23
-      assert_equal "", headers['Set-Cookie']
a647a23
+      #assert_equal "", headers['Set-Cookie']
a647a23
+      assert headers['Set-Cookie'].empty?
a647a23
     end
a647a23
   end
a647a23
 
a647a23
@@ -155,7 +156,8 @@
a647a23
         "fef868465920f415f2c0652d6910d3af288a0367"
a647a23
       get '/no_session_access'
a647a23
       assert_response :success
a647a23
-      assert_equal "", headers['Set-Cookie']
a647a23
+      #assert_equal "", headers['Set-Cookie']
a647a23
+      assert headers['Set-Cookie'].empty?
a647a23
     end
a647a23
   end
a647a23