about summary refs log tree commit homepage
path: root/lib/mongrel
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mongrel')
-rw-r--r--lib/mongrel/cgi.rb4
-rw-r--r--lib/mongrel/http_request.rb2
-rw-r--r--lib/mongrel/http_response.rb5
3 files changed, 7 insertions, 4 deletions
diff --git a/lib/mongrel/cgi.rb b/lib/mongrel/cgi.rb
index 4173bde..3957611 100644
--- a/lib/mongrel/cgi.rb
+++ b/lib/mongrel/cgi.rb
@@ -26,7 +26,7 @@ module Mongrel
   # Refer to DirHandler#can_serve for more information on this.
   class CGIWrapper < ::CGI
     public :env_table
-    attr_reader :options
+    attr_reader :head
     attr_accessor :handler
     # Set this to false if you want calls to CGIWrapper.out to not actually send
     # the response until you force it.
@@ -105,7 +105,7 @@ module Mongrel
         when Hash
           cookie.each_value {|c| to['Set-Cookie'] = c.to_s}
         else
-          to['Set-Cookie'] = options['cookie'].to_s
+          to['Set-Cookie'] = head['cookie'].to_s
         end
         
         @head.delete('cookie')
diff --git a/lib/mongrel/http_request.rb b/lib/mongrel/http_request.rb
index 82ffe42..c8d4ce4 100644
--- a/lib/mongrel/http_request.rb
+++ b/lib/mongrel/http_request.rb
@@ -93,7 +93,7 @@ module Mongrel
         STDERR.puts e.backtrace.join("\n")
         # any errors means we should delete the file, including if the file is dumped
         @socket.close rescue nil
-        @body.delete if @body.class == Tempfile
+        @body.close! if @body.class == Tempfile
         @body = nil # signals that there was a problem
       end
     end
diff --git a/lib/mongrel/http_response.rb b/lib/mongrel/http_response.rb
index 32e433e..3076712 100644
--- a/lib/mongrel/http_response.rb
+++ b/lib/mongrel/http_response.rb
@@ -75,7 +75,10 @@ module Mongrel
       elsif @header_sent
         raise "You have already sent the request headers."
       else
-        @header.out.truncate(0)
+        # XXX Dubious ( http://mongrel.rubyforge.org/ticket/19 )
+        @header.out.close
+        @header = HeaderOut.new(StringIO.new)
+        
         @body.close
         @body = StringIO.new
       end