File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ module HTTPServlet
28
28
class CGIHandler < AbstractServlet
29
29
Ruby = RbConfig . ruby # :nodoc:
30
30
CGIRunner = "\" #{ Ruby } \" \" #{ WEBrick ::Config ::LIBDIR } /httpservlet/cgi_runner.rb\" " # :nodoc:
31
+ CGIRunnerArray = [ Ruby , "#{ WEBrick ::Config ::LIBDIR } /httpservlet/cgi_runner.rb" . freeze ] . freeze # :nodoc:
31
32
32
33
##
33
34
# Creates a new CGI script servlet for the script at +name+
@@ -36,7 +37,12 @@ def initialize(server, name)
36
37
super ( server , name )
37
38
@script_filename = name
38
39
@tempdir = server [ :TempDir ]
39
- @cgicmd = "#{ CGIRunner } #{ server [ :CGIInterpreter ] } "
40
+ interpreter = server [ :CGIInterpreter ]
41
+ if interpreter . is_a? ( Array )
42
+ @cgicmd = CGIRunnerArray + interpreter
43
+ else
44
+ @cgicmd = "#{ CGIRunner } #{ interpreter } "
45
+ end
40
46
end
41
47
42
48
# :stopdoc:
Original file line number Diff line number Diff line change @@ -289,7 +289,7 @@ def test_script_disclosure
289
289
return if File . executable? ( __FILE__ ) # skip on strange file system
290
290
291
291
config = {
292
- :CGIInterpreter => TestWEBrick ::RubyBin ,
292
+ :CGIInterpreter => TestWEBrick ::RubyBinArray ,
293
293
:DocumentRoot => File . dirname ( __FILE__ ) ,
294
294
:CGIPathEnv => ENV [ 'PATH' ] ,
295
295
:RequestCallback => Proc . new { |req , res |
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ class WEBrick::HTTPServlet::CGIHandler
19
19
Ruby = EnvUtil . rubybin
20
20
remove_const :CGIRunner
21
21
CGIRunner = "\" #{ Ruby } \" \" #{ WEBrick ::Config ::LIBDIR } /httpservlet/cgi_runner.rb\" " # :nodoc:
22
+ remove_const :CGIRunnerArray
23
+ CGIRunnerArray = [ Ruby , "#{ WEBrick ::Config ::LIBDIR } /httpservlet/cgi_runner.rb" ] # :nodoc:
22
24
end
23
25
24
26
RubyBin = "\" #{ EnvUtil . rubybin } \" "
@@ -27,6 +29,12 @@ class WEBrick::HTTPServlet::CGIHandler
27
29
RubyBin << " \" -I#{ File . dirname ( EnvUtil . rubybin ) } /.ext/common\" "
28
30
RubyBin << " \" -I#{ File . dirname ( EnvUtil . rubybin ) } /.ext/#{ RUBY_PLATFORM } \" "
29
31
32
+ RubyBinArray = [ EnvUtil . rubybin ]
33
+ RubyBinArray << "--disable-gems"
34
+ RubyBinArray << "-I" << "#{ File . expand_path ( "../.." , File . dirname ( __FILE__ ) ) } /lib"
35
+ RubyBinArray << "-I" << "#{ File . dirname ( EnvUtil . rubybin ) } /.ext/common"
36
+ RubyBinArray << "-I" << "#{ File . dirname ( EnvUtil . rubybin ) } /.ext/#{ RUBY_PLATFORM } "
37
+
30
38
require "test/unit" unless defined? ( Test ::Unit )
31
39
include Test ::Unit ::Assertions
32
40
extend Test ::Unit ::Assertions
You can’t perform that action at this time.
0 commit comments