summary refs log tree commit
diff options
context:
space:
mode:
authorGraham <graham-git@stormbrew.ca>2010-12-02 09:48:13 +0800
committerMichael Fellinger <m.fellinger@gmail.com>2010-12-11 14:54:14 +0800
commitb79ea447e8d0d9ee7abd641baa8c535e4d2e3a2c (patch)
tree6f9a0ccba90645e6bd0030545d27b066dade30f7
parent469518f7d971ba99fc335cf546d605d2364c81aa (diff)
downloadrack-b79ea447e8d0d9ee7abd641baa8c535e4d2e3a2c.tar.gz
FastCGI Handler should not rebind to host/port if file is set.
File should override Port/Host so that things like Rackup that *always* pass in a host/port combination can be overriden by the File parameter. This change makes that happen.
-rw-r--r--lib/rack/handler/fastcgi.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/rack/handler/fastcgi.rb b/lib/rack/handler/fastcgi.rb
index 8fa24d72..29281e85 100644
--- a/lib/rack/handler/fastcgi.rb
+++ b/lib/rack/handler/fastcgi.rb
@@ -19,8 +19,11 @@ module Rack
   module Handler
     class FastCGI
       def self.run(app, options={})
-        file = options[:File] and STDIN.reopen(UNIXServer.new(file))
-        port = options[:Port] and STDIN.reopen(TCPServer.new(options[:Host], port))
+        if options[:File]
+          file = STDIN.reopen(UNIXServer.new(options[:File]))
+        elsif options[:Port]
+          port = STDIN.reopen(TCPServer.new(options[:Host], options[:Port]))
+        end
         FCGI.each { |request|
           serve request, app
         }