public
Description: A very fast & simple Ruby web server
Homepage: http://code.macournoyer.com/thin/
Clone URL: git://github.com/macournoyer/thin.git
Search Repo:
* Revert to using #each when building response headers under Ruby 1.8,
  solves an issue w/ Camping adapter, fixes #22
macournoyer (author)
Sun Jan 27 14:17:45 -0800 2008
commit  f7451b3df8d0e367bc4a0fbbcefaff2a283e7af5
tree    a01551d9cf32858fddb49c12845da7417943d0d9
parent  995ab959a4d5386e3811f00802d90656c2f8a3fd
...
1
 
 
2
3
4
...
1
2
3
4
5
6
0
@@ -1,4 +1,6 @@
0
 == 0.6.2 Rambo release
0
+ * Revert to using #each when building response headers under Ruby 1.8,
0
+ solves an issue w/ Camping adapter, fixes #22
0
  * Restructure thin script options in 3 sections: server, daemon and cluster
0
  * Add --only (-o) option to control only one server of a cluster.
0
  * Stylize stats page and make the url configurable from the thin script.
...
34
35
36
37
38
39
 
 
 
 
 
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
42
43
...
34
35
36
 
 
 
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
0
@@ -34,10 +34,27 @@
0
       "HTTP/1.1 #{@status} #{HTTP_STATUS_CODES[@status.to_i]}\r\n#{headers_output}\r\n"
0
     end
0
     
0
- def headers=(key_value_pairs)
0
- key_value_pairs.each do |k, vs|
0
- vs.each_line { |v| @headers[k] = v.chomp }
0
+ if Thin.ruby_18?
0
+ def headers=(key_value_pairs)
0
+ key_value_pairs.each do |k, vs|
0
+ vs.each { |v| @headers[k] = v.chomp }
0
+ end
0
       end
0
+ else
0
+ # Ruby 1.9 doesn't have a String#each anymore.
0
+ # Rack spec doesn't take care of that yet, for now we just use
0
+ # +each+ but fallback to +each_line+ on strings.
0
+ # I wish we could remove that condition.
0
+ # To be reviewed when a new Rack spec comes out.
0
+ def headers=(key_value_pairs)
0
+ key_value_pairs.each do |k, vs|
0
+ if vs.is_a?(String)
0
+ vs.each_line { |v| @headers[k] = v.chomp }
0
+ else
0
+ vs.each { |v| @headers[k] = v.chomp }
0
+ end
0
+ end
0
+ end
0
     end
0
     
0
     # Close any resource used by the response
...
1
 
 
2
3
4
...
13
14
15
16
 
 
 
17
...
1
2
3
4
5
6
...
15
16
17
 
18
19
20
21
0
@@ -1,4 +1,6 @@
0
 module Thin
0
+ class PlatformNotSupported < RuntimeError; end
0
+
0
   module VERSION #:nodoc:
0
     MAJOR = 0
0
     MINOR = 6
0
@@ -13,6 +15,8 @@
0
     RUBY_PLATFORM =~ /mswin/
0
   end
0
   
0
- class PlatformNotSupported < RuntimeError; end
0
+ def self.ruby_18?
0
+ RUBY_VERSION =~ /^1\.8/
0
+ end
0
 end

Comments

    No one has commented yet.