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:
Load cgi_multipart_eof_fix if Ruby 1.8.5, closes #49
macournoyer (author)
Sun Mar 02 11:32:21 -0800 2008
commit  4c30c781a26b14bd7038646a6c258f57cb91c1f3
tree    8d363642dfc6baf12dd4273676e62c684b26c098
parent  3380e9a2bdafb94b75b766255e4cd00fb4eb0046
...
1
 
2
3
4
...
1
2
3
4
5
0
@@ -1,4 +1,5 @@
0
 == 0.7.1 Fancy Pants release
0
+ * Ruby 1.8.5 compatibility, closes #49 [Wincent Colaiuta]
0
  * Move all EventMachine stuff out of Server, you can now create a Thin Backend that
0
    does not depend on EventMachine.
0
  * Rename Connector to Backend. Extend Thin::Backends::Base to implement your own.
...
87
88
89
 
 
90
91
92
...
186
187
188
189
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
191
...
87
88
89
90
91
92
93
94
...
188
189
190
 
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
0
@@ -87,6 +87,8 @@
0
       else
0
         Backends::TcpServer.new(host_or_socket_or_backend, port.to_i)
0
       end
0
+
0
+ load_cgi_multipart_eof_fix
0
 
0
       @app = app
0
       @backend.server = self
0
@@ -186,7 +188,21 @@
0
         trap('QUIT') { stop } unless Thin.win?
0
         trap('INT') { stop! }
0
         trap('TERM') { stop! }
0
- end
0
+ end
0
+
0
+ # Taken from Mongrel cgi_multipart_eof_fix
0
+ def load_cgi_multipart_eof_fix
1
+ version = RUBY_VERSION.split('.').map { |i| i.to_i }
0
+
0
+ if version[0] <= 1 && version[1] <= 8 && version[2] <= 5 && RUBY_PLATFORM !~ /java/
0
+ begin
0
+ require 'cgi_multipart_eof_fix'
0
+ rescue LoadError
0
+ log "!! Ruby 1.8.5 is not secure please install cgi_multipart_eof_fix:"
0
+ log " gem install cgi_multipart_eof_fix"
0
+ end
0
+ end
0
+ end
0
   end
0
 end

Comments

  • mudge Sat Apr 12 16:29:47 -0700 2008 at lib/thin/server.rb L104

    Is there a specific reason why RUBY_VERSION has to be split and its constituent parts converted into integers instead of just doing RUBY_VERSION <= “1.8.5”?

  • macournoyer Sat Apr 12 17:54:27 -0700 2008

    because “1.8.10” <= “1.8.5” == true

  • elliottcable Sat Apr 12 20:44:07 -0700 2008

    /me is envisioning a new Version class, with modified methods that fix this…

  • mudge Sun Apr 13 09:42:49 -0700 2008

    Ah, that answers that. Thanks for the response.