about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--Rakefile2
-rw-r--r--bin/mongrel_rails2
-rw-r--r--ext/http11/http11.c2
-rw-r--r--lib/mongrel.rb7
-rw-r--r--test/test_response.rb18
5 files changed, 27 insertions, 4 deletions
diff --git a/Rakefile b/Rakefile
index e90ce56..7f6ff03 100644
--- a/Rakefile
+++ b/Rakefile
@@ -53,7 +53,7 @@ task :site => [:site_webgen, :site_rdoc, :site_coverage, :site_projects_rdoc]
 setup_extension("http11", "http11")
 
 name="mongrel"
-version="0.3.19"
+version="0.3.20"
 
 setup_gem(name, version) do |spec|
   spec.summary = "A small fast HTTP library and server that runs Rails, Camping, Nitro and Iowa apps."
diff --git a/bin/mongrel_rails b/bin/mongrel_rails
index a59a591..05205cb 100644
--- a/bin/mongrel_rails
+++ b/bin/mongrel_rails
@@ -84,6 +84,8 @@ module Mongrel
         if defaults[:daemon]
           if File.exist? defaults[:pid_file]
             log "!!! PID file #{defaults[:pid_file]} already exists.  Mongrel could be running already.  Check your #{defaults[:log_file]} for errors."
+            log "!!! Exiting with error.  You must stop mongrel and clear the .pid before I'll attempt a start."
+            exit 1
           end
 
           daemonize
diff --git a/ext/http11/http11.c b/ext/http11/http11.c
index aa23617..0425f9e 100644
--- a/ext/http11/http11.c
+++ b/ext/http11/http11.c
@@ -556,7 +556,7 @@ void Init_http11()
   DEF_GLOBAL(server_protocol, "SERVER_PROTOCOL");
   DEF_GLOBAL(server_protocol_value, "HTTP/1.1");
   DEF_GLOBAL(http_host, "HTTP_HOST");
-  DEF_GLOBAL(mongrel_version, "Mongrel 0.3.19");
+  DEF_GLOBAL(mongrel_version, "Mongrel 0.3.20");
   DEF_GLOBAL(server_software, "SERVER_SOFTWARE");
   DEF_GLOBAL(port_80, "80");
 
diff --git a/lib/mongrel.rb b/lib/mongrel.rb
index 7c6b406..4a7e352 100644
--- a/lib/mongrel.rb
+++ b/lib/mongrel.rb
@@ -125,7 +125,7 @@ module Mongrel
     REQUEST_URI='REQUEST_URI'.freeze
     REQUEST_PATH='REQUEST_PATH'.freeze
 
-    MONGREL_VERSION="0.3.19".freeze
+    MONGREL_VERSION="0.3.20".freeze
 
     MONGREL_TMP_BASE="mongrel".freeze
 
@@ -336,15 +336,18 @@ module Mongrel
   # semantics for Hash (where doing an insert replaces) is not there.
   class HeaderOut
     attr_reader :out
+    attr_accessor :allowed_duplicates
 
     def initialize(out)
       @sent = {}
+      @allowed_duplicates = {"Set-Cookie" => true, "Set-Cookie2" => true,
+        "Warning" => true, "WWW-Authenticate" => true}
       @out = out
     end
 
     # Simply writes "#{key}: #{value}" to an output buffer.
     def[]=(key,value)
-      if not @sent.has_key?(key)
+      if not @sent.has_key?(key) or @allowed_duplicates.has_key?(key)
         @sent[key] = true
         @out.write(Const::HEADER_FORMAT % [key, value])
       end
diff --git a/test/test_response.rb b/test/test_response.rb
index c5e1084..584b28f 100644
--- a/test/test_response.rb
+++ b/test/test_response.rb
@@ -50,6 +50,24 @@ class ResponseTest < Test::Unit::TestCase
     assert_equal io.length, 95, "too much output"
   end
 
+
+  def test_response_some_duplicates_allowed
+    allowed_duplicates = ["Set-Cookie", "Set-Cookie2", "Warning", "WWW-Authenticate"]
+    io = StringIO.new
+    resp = HttpResponse.new(io)
+    resp.start do |head,out|
+      allowed_duplicates.each do |dup|
+        10.times do |i|
+          head[dup] = i
+        end
+      end
+    end
+
+    resp.finished
+
+    assert_equal io.length, 734, "wrong amount of output"
+  end
+
   def test_response_404
     io = StringIO.new