public
Rubygem
Description: A very fast & simple Ruby web server
Homepage: http://code.macournoyer.com/thin/
Clone URL: git://github.com/macournoyer/thin.git
Click here to lend your support to: thin and make a donation at www.pledgie.com !
Make Set-Cookie header, in Rails adapter, compatible with current Rack spec 
[Pedro Belo]
[#73, state:resolved]
macournoyer (author)
Sun Jul 13 21:03:01 -0700 2008
commit  34da9ea800d4667a8a15700610ffc9fff71b9806
tree    ceb8c97cd4b79c9cc61b0aa8430769865547bf43
parent  37fbf1d50876315d94865e6ad44c4ac4d9840599
...
1
 
 
2
3
4
...
1
2
3
4
5
6
0
@@ -1,4 +1,6 @@
0
 == 1.0.0 The Big release
0
+ * Make Set-Cookie header, in Rails adapter, compatible with current Rack spec [Pedro Belo]
0
+   [#73, state:resolved]
0
  * Add --no-epoll option to disable epoll usage on Linux [#61 state:resolved]
0
  * Add --force (-f) option to force stopping of a daemonized server [#72 state:resolved]
0
  * Update halycon adapter loader [mtodd]
...
112
113
114
115
 
116
117
118
 
 
 
 
 
 
 
119
120
121
...
112
113
114
 
115
116
117
 
118
119
120
121
122
123
124
125
126
127
0
@@ -112,10 +112,16 @@ module Rack
0
                   when Hash  then cookie.each { |_, c| cookies << c.to_s }
0
                   else            cookies << cookie.to_s
0
                 end
0
-        
0
+                
0
                 @output_cookies.each { |c| cookies << c.to_s } if @output_cookies
0
                 
0
-                @response['Set-Cookie'] = [@response['Set-Cookie'], cookies].compact.join("\n")
0
+                @response['Set-Cookie'] = [@response['Set-Cookie'], cookies].compact
0
+                # See http://groups.google.com/group/rack-devel/browse_thread/thread/e8759b91a82c5a10/a8dbd4574fe97d69?#a8dbd4574fe97d69
0
+                if Thin.ruby_18?
0
+                  @response['Set-Cookie'].flatten!
0
+                else
0
+                  @response['Set-Cookie'] = @response['Set-Cookie'].join("\n")
0
+                end
0
               end
0
               
0
               options.each { |k,v| @response[k] = v }
...
21
22
23
24
 
25
26
27
...
31
32
33
34
 
35
36
37
38
39
40
41
 
42
43
44
45
46
47
48
 
49
50
51
...
57
58
59
60
 
61
62
63
...
69
70
71
72
 
73
74
75
 
 
 
 
76
77
78
...
21
22
23
 
24
25
26
27
...
31
32
33
 
34
35
36
37
38
39
40
 
41
42
43
44
45
46
47
 
48
49
50
51
...
57
58
59
 
60
61
62
63
...
69
70
71
 
72
73
 
 
74
75
76
77
78
79
80
0
@@ -21,7 +21,7 @@ begin
0
 
0
     it "should handle POST parameters" do
0
       data = "foo=bar"
0
-      res = @request.post("/simple/post_form", :input => data, 'CONTENT_LENGTH' => data.size)
0
+      res = @request.post("/simple/post_form", :input => data, 'CONTENT_LENGTH' => data.size.to_s, :lint => true)
0
 
0
       res.should be_ok
0
       res["Content-Type"].should include("text/html")
0
@@ -31,21 +31,21 @@ begin
0
     end
0
   
0
     it "should serve static files" do
0
-      res = @request.get("/index.html")
0
+      res = @request.get("/index.html", :lint => true)
0
 
0
       res.should be_ok
0
       res["Content-Type"].should include("text/html")
0
     end
0
     
0
     it "should serve root with index.html if present" do
0
-      res = @request.get("/")
0
+      res = @request.get("/", :lint => true)
0
 
0
       res.should be_ok
0
       res["Content-Length"].to_i.should == File.size(@rails_app_path + '/public/index.html')
0
     end
0
     
0
     it "should serve page cache if present" do
0
-      res = @request.get("/simple/cached?value=cached")
0
+      res = @request.get("/simple/cached?value=cached", :lint => true)
0
 
0
       res.should be_ok
0
       res.body.should == 'cached'
0
@@ -57,7 +57,7 @@ begin
0
     end
0
     
0
     it "should not serve page cache on POST request" do
0
-      res = @request.get("/simple/cached?value=cached")
0
+      res = @request.get("/simple/cached?value=cached", :lint => true)
0
 
0
       res.should be_ok
0
       res.body.should == 'cached'
0
@@ -69,10 +69,12 @@ begin
0
     end
0
     
0
     it "handles multiple cookies" do
0
-      res = @request.get('/simple/set_cookie?name=a&value=1')
0
+      res = @request.get('/simple/set_cookie?name=a&value=1', :lint => true)
0
     
0
-      res.should be_ok    
0
-      res.original_headers['Set-Cookie'].should include('a=1; path=/', '_rails_app_session')
0
+      res.should be_ok
0
+      res.original_headers['Set-Cookie'].size.should == 2
0
+      res.original_headers['Set-Cookie'].first.should include('a=1; path=/')
0
+      res.original_headers['Set-Cookie'].last.should include('_rails_app_session')
0
     end
0
     
0
     after do

Comments