about summary refs log tree commit homepage
path: root/lib/mongrel.rb
diff options
context:
space:
mode:
authorzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-11-20 16:51:42 +0000
committerzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-11-20 16:51:42 +0000
commit21a6ec5e926ddf0746bcf2a299aee189365c67a1 (patch)
tree46f8ca869048b9a71ede60fe8bd5e3ea941f0d79 /lib/mongrel.rb
parentbfed27de4fe2f7a44cee1cd6a42d98d6a606f797 (diff)
downloadunicorn-21a6ec5e926ddf0746bcf2a299aee189365c67a1.tar.gz
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@396 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'lib/mongrel.rb')
-rw-r--r--lib/mongrel.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/mongrel.rb b/lib/mongrel.rb
index 4df0e3f..4e94f0a 100644
--- a/lib/mongrel.rb
+++ b/lib/mongrel.rb
@@ -9,7 +9,7 @@ $mongrel_debug_client = false
 require 'socket'
 require 'http11'
 require 'tempfile'
-require 'thread'
+require 'fastthread'
 require 'stringio'
 require 'mongrel/cgi'
 require 'mongrel/handlers'
@@ -200,6 +200,7 @@ module Mongrel
         @mpart_type, @mpart_boundary = @params['CONTENT_TYPE'].split(/;\s*/)
         if @mpart_type and @mpart_boundary and @mpart_boundary.include? "="
           @mpart_boundary = @mpart_boundary.split("=")[1].strip
+          STDERR.puts "boundary: #{@mpart_boundary}"
           @params['MULTIPART_TYPE'] = @mpart_type
           @params['MULTIPART_BOUNDARY'] = @mpart_boundary
           @search = BMHSearch.new(@mpart_boundary, 100)
@@ -230,11 +231,12 @@ module Mongrel
         read_body(remain, content_length, dispatcher)
       end
 
-      if @search
+      if @search and @body
+        STDERR.puts "number of boundaries: #{@search.nfound}"
         @body.rewind
         @search.pop.each do |boundary|
-          @body.seek(boundary)
-          STDERR.puts "BOUNDARY at #{boundary}: #{@body.readline}"
+          @body.seek(boundary - 2)
+          STDERR.puts "BOUNDARY at #{boundary}: #{@body.read(@mpart_boundary.length + 2)}"
         end
       end