mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/webrick] Allow WEBrick::HTTPServlet::CGIHandler :CGIInterpreter option to be array
This way you don't need to escape each entry. Implements Ruby Feature 15170. https://github.com/ruby/webrick/commit/d8086e600c
This commit is contained in:
parent
f7cf5416e4
commit
c75100d004
3 changed files with 16 additions and 2 deletions
|
@ -28,6 +28,7 @@ module WEBrick
|
||||||
class CGIHandler < AbstractServlet
|
class CGIHandler < AbstractServlet
|
||||||
Ruby = RbConfig.ruby # :nodoc:
|
Ruby = RbConfig.ruby # :nodoc:
|
||||||
CGIRunner = "\"#{Ruby}\" \"#{WEBrick::Config::LIBDIR}/httpservlet/cgi_runner.rb\"" # :nodoc:
|
CGIRunner = "\"#{Ruby}\" \"#{WEBrick::Config::LIBDIR}/httpservlet/cgi_runner.rb\"" # :nodoc:
|
||||||
|
CGIRunnerArray = [Ruby, "#{WEBrick::Config::LIBDIR}/httpservlet/cgi_runner.rb".freeze].freeze # :nodoc:
|
||||||
|
|
||||||
##
|
##
|
||||||
# Creates a new CGI script servlet for the script at +name+
|
# Creates a new CGI script servlet for the script at +name+
|
||||||
|
@ -36,7 +37,12 @@ module WEBrick
|
||||||
super(server, name)
|
super(server, name)
|
||||||
@script_filename = name
|
@script_filename = name
|
||||||
@tempdir = server[:TempDir]
|
@tempdir = server[:TempDir]
|
||||||
@cgicmd = "#{CGIRunner} #{server[:CGIInterpreter]}"
|
interpreter = server[:CGIInterpreter]
|
||||||
|
if interpreter.is_a?(Array)
|
||||||
|
@cgicmd = CGIRunnerArray + interpreter
|
||||||
|
else
|
||||||
|
@cgicmd = "#{CGIRunner} #{interpreter}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# :stopdoc:
|
# :stopdoc:
|
||||||
|
|
|
@ -289,7 +289,7 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase
|
||||||
return if File.executable?(__FILE__) # skip on strange file system
|
return if File.executable?(__FILE__) # skip on strange file system
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
:CGIInterpreter => TestWEBrick::RubyBin,
|
:CGIInterpreter => TestWEBrick::RubyBinArray,
|
||||||
:DocumentRoot => File.dirname(__FILE__),
|
:DocumentRoot => File.dirname(__FILE__),
|
||||||
:CGIPathEnv => ENV['PATH'],
|
:CGIPathEnv => ENV['PATH'],
|
||||||
:RequestCallback => Proc.new{|req, res|
|
:RequestCallback => Proc.new{|req, res|
|
||||||
|
|
|
@ -19,6 +19,8 @@ module TestWEBrick
|
||||||
Ruby = EnvUtil.rubybin
|
Ruby = EnvUtil.rubybin
|
||||||
remove_const :CGIRunner
|
remove_const :CGIRunner
|
||||||
CGIRunner = "\"#{Ruby}\" \"#{WEBrick::Config::LIBDIR}/httpservlet/cgi_runner.rb\"" # :nodoc:
|
CGIRunner = "\"#{Ruby}\" \"#{WEBrick::Config::LIBDIR}/httpservlet/cgi_runner.rb\"" # :nodoc:
|
||||||
|
remove_const :CGIRunnerArray
|
||||||
|
CGIRunnerArray = [Ruby, "#{WEBrick::Config::LIBDIR}/httpservlet/cgi_runner.rb"] # :nodoc:
|
||||||
end
|
end
|
||||||
|
|
||||||
RubyBin = "\"#{EnvUtil.rubybin}\""
|
RubyBin = "\"#{EnvUtil.rubybin}\""
|
||||||
|
@ -27,6 +29,12 @@ module TestWEBrick
|
||||||
RubyBin << " \"-I#{File.dirname(EnvUtil.rubybin)}/.ext/common\""
|
RubyBin << " \"-I#{File.dirname(EnvUtil.rubybin)}/.ext/common\""
|
||||||
RubyBin << " \"-I#{File.dirname(EnvUtil.rubybin)}/.ext/#{RUBY_PLATFORM}\""
|
RubyBin << " \"-I#{File.dirname(EnvUtil.rubybin)}/.ext/#{RUBY_PLATFORM}\""
|
||||||
|
|
||||||
|
RubyBinArray = [EnvUtil.rubybin]
|
||||||
|
RubyBinArray << "--disable-gems"
|
||||||
|
RubyBinArray << "-I" << "#{File.expand_path("../..", File.dirname(__FILE__))}/lib"
|
||||||
|
RubyBinArray << "-I" << "#{File.dirname(EnvUtil.rubybin)}/.ext/common"
|
||||||
|
RubyBinArray << "-I" << "#{File.dirname(EnvUtil.rubybin)}/.ext/#{RUBY_PLATFORM}"
|
||||||
|
|
||||||
require "test/unit" unless defined?(Test::Unit)
|
require "test/unit" unless defined?(Test::Unit)
|
||||||
include Test::Unit::Assertions
|
include Test::Unit::Assertions
|
||||||
extend Test::Unit::Assertions
|
extend Test::Unit::Assertions
|
||||||
|
|
Loading…
Add table
Reference in a new issue