From e7638ef887ff8bd1a24b3262f7e69ebad84f9381 Mon Sep 17 00:00:00 2001 From: HD Moore Date: Mon, 26 Oct 2009 17:33:05 +0000 Subject: [PATCH] Fixes #397. Webrick requires :BindAddress but msfweb only passed in :Host, likely an api change was missed during a rails upgrade. git-svn-id: file:///home/svn/framework3/trunk@7277 4d416f70-5f16-0410-b530-b9f4589650da --- .../rails/railties/lib/commands/server.rb | 2 +- msfweb | 21 ++++++++----------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/data/msfweb/vendor/rails/railties/lib/commands/server.rb b/data/msfweb/vendor/rails/railties/lib/commands/server.rb index ebe34a42cd..7260d88123 100644 --- a/data/msfweb/vendor/rails/railties/lib/commands/server.rb +++ b/data/msfweb/vendor/rails/railties/lib/commands/server.rb @@ -25,7 +25,7 @@ ARGV.clone.options do |opts| opts.on("-p", "--port=port", Integer, "Runs Rails on the specified port.", "Default: 3000") { |v| options[:Port] = v } opts.on("-b", "--binding=ip", String, - "Binds Rails to the specified ip.", "Default: 0.0.0.0") { |v| options[:Host] = v } + "Binds Rails to the specified ip.", "Default: 0.0.0.0") { |v| options[:BindAddress] = options[:Host] = v } opts.on("-c", "--config=file", String, "Use custom rackup configuration file") { |v| options[:config] = v } opts.on("-d", "--daemon", "Make server run as a Daemon.") { options[:detach] = true } diff --git a/msfweb b/msfweb index 7803e5cd33..44d4b60d39 100755 --- a/msfweb +++ b/msfweb @@ -38,7 +38,7 @@ background = false browser_start = false # Parse command line arguments. -arguments.parse(ARGV) { |opt, idx, val| +arguments.parse(ARGV) do |opt, idx, val| case opt when "-a" opts['ServerHost'] = val @@ -56,23 +56,20 @@ arguments.parse(ARGV) { |opt, idx, val| arguments.usage) exit end -} +end +# Drain ARGV +while(ARGV.shift) do +end -# This is stupid, but we need to override the ARGV constant - -ostderr = $stderr -$stderr = StringIO.new - -ARGV = [ +# Rebuild ARGV +ARGV.unshift([ '-p', opts['ServerPort'], '-b', opts['ServerHost'], '-e', 'production', (background ? '-d' : '') -] - -$stderr.close -$stderr = ostderr +]) +ARGV.flatten! $browser_url = "http://#{opts['ServerHost']}:#{opts['ServerPort']}/" $browser_start = browser_start