<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,8 @@
+== 1.2.1 Asynctilicious Ultra Supreme release
+ * Use Rails Rack based dispatcher when available in Rails 2.3
+ * Allow String for response body
+ * Require openssl before eventmachine to prevent crash in 1.9
+
 == 1.2.0 Asynctilicious Supreme release 
  * Add support for Windows mingw Ruby distro [Juan C. Rodriguez]
  * Add async response support, see example/async_*.ru [raggi]</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -22,7 +22,13 @@ module Rack
         
         load_application
         
-        @file_server = Rack::File.new(::File.join(RAILS_ROOT, &quot;public&quot;))
+        @rails_app = if ActionController::Dispatcher.instance_methods.include?(:call)
+          ActionController::Dispatcher.new
+        else
+          CgiApp.new
+        end
+        
+        @file_app = Rack::File.new(::File.join(RAILS_ROOT, &quot;public&quot;))
       end
       
       def load_application
@@ -32,7 +38,7 @@ module Rack
         require 'dispatcher'
         
         if @prefix
-          if ActionController::Base.respond_to?('relative_url_root=')
+          if ActionController::Base.respond_to?(:relative_url_root=)
             ActionController::Base.relative_url_root = @prefix # Rails 2.1.1
           else
             ActionController::AbstractRequest.relative_url_root = @prefix
@@ -40,28 +46,11 @@ module Rack
         end
       end
       
-      # TODO refactor this in File#can_serve?(path) ??
       def file_exist?(path)
-        full_path = ::File.join(@file_server.root, Utils.unescape(path))
+        full_path = ::File.join(@file_app.root, Utils.unescape(path))
         ::File.file?(full_path) &amp;&amp; ::File.readable_real?(full_path)
       end
       
-      def serve_file(env)
-        @file_server.call(env)
-      end
-      
-      def serve_rails(env)
-        request         = Request.new(env)
-        response        = Response.new
-        
-        session_options = ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS
-        cgi             = CGIWrapper.new(request, response)
-    
-        Dispatcher.dispatch(cgi, session_options, response)
-
-        response.finish
-      end
-      
       def call(env)
         path        = env['PATH_INFO'].chomp('/')
         method      = env['REQUEST_METHOD']
@@ -69,18 +58,31 @@ module Rack
         
         if FILE_METHODS.include?(method)
           if file_exist?(path)              # Serve the file if it's there
-            return serve_file(env)
+            return @file_app.call(env)
           elsif file_exist?(cached_path)    # Serve the page cache if it's there
             env['PATH_INFO'] = cached_path
-            return serve_file(env)
+            return @file_app.call(env)
           end
         end
         
         # No static file, let Rails handle it
-        serve_rails(env)
+        @rails_app.call(env)
       end
     
       protected
+        # For Rails pre Rack (2.3)
+        class CgiApp
+          def call(env)
+            request         = Request.new(env)
+            response        = Response.new
+            session_options = ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS
+            cgi             = CGIWrapper.new(request, response)
+
+            Dispatcher.dispatch(cgi, session_options, response)
+
+            response.finish
+          end
+        end
         
         class CGIWrapper &lt; ::CGI
           def initialize(request, response, *args)</diff>
      <filename>lib/rack/adapter/rails.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,6 +7,7 @@ require 'time'
 require 'forwardable'
 
 require 'rubygems'
+require 'openssl'
 require 'eventmachine'
 
 require 'thin/version'</diff>
      <filename>lib/thin.rb</filename>
    </modified>
    <modified>
      <diff>@@ -80,8 +80,10 @@ module Thin
     # define your own +each+ method on +body+.
     def each
       yield head
-      @body.each do |chunk|
-        yield chunk
+      if @body.is_a?(String)
+        yield @body
+      else
+        @body.each { |chunk| yield chunk }
       end
     end
 </diff>
      <filename>lib/thin/response.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,11 +6,11 @@ module Thin
   module VERSION #:nodoc:
     MAJOR    = 1
     MINOR    = 2
-    TINY     = 0
+    TINY     = 1
     
     STRING   = [MAJOR, MINOR, TINY].join('.')
     
-    CODENAME = &quot;Asynctilicious Supreme&quot;.freeze
+    CODENAME = &quot;Asynctilicious Ultra Supreme&quot;.freeze
     
     RACK     = [0, 1].freeze # Rack protocol version that was tested
   end</diff>
      <filename>lib/thin/version.rb</filename>
    </modified>
    <modified>
      <diff>@@ -52,6 +52,14 @@ describe Response do
   end
   
   it 'should output body' do
+    @response.body = ['&lt;html&gt;', '&lt;/html&gt;']
+    
+    out = ''
+    @response.each { |l| out &lt;&lt; l }
+    out.should include(&quot;\r\n\r\n&lt;html&gt;&lt;/html&gt;&quot;)
+  end
+    
+  it 'should output String body' do
     @response.body = '&lt;html&gt;&lt;/html&gt;'
     
     out = ''</diff>
      <filename>spec/response_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>bba1db29ff910da218a6c45481e97d80b9dc7208</id>
    </parent>
  </parents>
  <author>
    <name>macournoyer</name>
    <email>macournoyer@gmail.com</email>
  </author>
  <url>http://github.com/macournoyer/thin/commit/a303c274bbba38d46e6164672921b9610ec28c77</url>
  <id>a303c274bbba38d46e6164672921b9610ec28c77</id>
  <committed-date>2009-04-21T19:58:24-07:00</committed-date>
  <authored-date>2009-04-21T19:58:24-07:00</authored-date>
  <message>* Use Rails Rack based dispatcher when available in Rails 2.3
* Allow String for response body
* Require openssl before eventmachine to prevent crash in 1.9</message>
  <tree>41016e3c940d13f4f97e98c4be996fc97228bbe4</tree>
  <committer>
    <name>macournoyer</name>
    <email>macournoyer@gmail.com</email>
  </committer>
</commit>
