summaryrefslogtreecommitdiffstats
path: root/lib/webrick
diff options
context:
space:
mode:
authorgotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-07-18 16:15:37 +0000
committergotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-07-18 16:15:37 +0000
commit3d391146d116d48402a878cc321ef3d4806ff84f (patch)
treef6c90af806ee5e2f40e75e25b84f5db1bc413342 /lib/webrick
parentf4016943b1c8b445fcad05a25a27050d9437afd5 (diff)
downloadruby-3d391146d116d48402a878cc321ef3d4806ff84f.tar.gz
ruby-3d391146d116d48402a878cc321ef3d4806ff84f.tar.xz
ruby-3d391146d116d48402a878cc321ef3d4806ff84f.zip
* lib/webrick/httpservlet/cgihandler.rb
(WEBrick::HTTPServlet::CGIhandler#do_GET): set SystemRoot environment variable to CGI process on Windows native platforms. [ruby-dev:23936] * lib/webrick/httpservlet/cgihandler.rb (WEBrick::HTTPServlet::CGIhandler#do_GET): use $?.exitstatus and refine log message. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@6676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/webrick')
-rw-r--r--lib/webrick/httpservlet/cgihandler.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/webrick/httpservlet/cgihandler.rb b/lib/webrick/httpservlet/cgihandler.rb
index aa92bb4a2..7dd330ba7 100644
--- a/lib/webrick/httpservlet/cgihandler.rb
+++ b/lib/webrick/httpservlet/cgihandler.rb
@@ -41,6 +41,9 @@ module WEBrick
meta = req.meta_vars
meta["SCRIPT_FILENAME"] = @script_filename
meta["PATH"] = @config[:CGIPathEnv]
+ if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
+ meta["SystemRoot"] = ENV["SystemRoot"]
+ end
dump = Marshal.dump(meta)
cgi_in.write("%8d" % cgi_out.path.size)
@@ -55,8 +58,8 @@ module WEBrick
end
ensure
cgi_in.close
- status = $? >> 8
- sleep 0.1 if /mswin/ =~ RUBY_PLATFORM
+ status = $?.exitstatus
+ sleep 0.1 if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
data = cgi_out.read
cgi_out.close(true)
if errmsg = cgi_err.read
@@ -74,7 +77,7 @@ module WEBrick
data = "" unless data
raw_header, body = data.split(/^[\xd\xa]+/on, 2)
raise HTTPStatus::InternalServerError,
- "The server encontered a script error." if body.nil?
+ "Premature end of script headers: #{@script_filename}" if body.nil?
begin
header = HTTPUtils::parse_header(raw_header)