mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 01:23:57 +02:00
* lib/webrick/cgi.rb (WEBrick::CGI::Socket#request_line):
ENV["REQUEST_URI"] is better to get correct Request-URI than ENV["SCRIPT_NAME"] + ENV["PATH_INFO"]. [ruby-dev:26235] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4eae21a92d
commit
63c32170e7
4 changed files with 24 additions and 5 deletions
|
@ -16,6 +16,7 @@ class TestWEBrickCGI < Test::Unit::TestCase
|
|||
config = {
|
||||
:CGIInterpreter => EnvUtil.rubybin,
|
||||
:DocumentRoot => File.dirname(__FILE__),
|
||||
:DirectoryIndex => ["webrick.cgi"],
|
||||
}
|
||||
TestWEBrick.start_httpserver(config){|server, addr, port|
|
||||
http = Net::HTTP.new(addr, port)
|
||||
|
@ -41,6 +42,12 @@ class TestWEBrickCGI < Test::Unit::TestCase
|
|||
req["Content-Type"] = "application/x-www-form-urlencoded"
|
||||
http.request(req, "a=1&a=2&b=x"){|res|
|
||||
assert_equal("a=1, a=2, b=x", res.body)}
|
||||
req = Net::HTTP::Get.new("/")
|
||||
http.request(req){|res|
|
||||
ary = res.body.to_a
|
||||
assert_match(%r{/$}, ary[0])
|
||||
assert_match(%r{/webrick.cgi$}, ary[1])
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,6 +12,10 @@ class TestApp < WEBrick::CGI
|
|||
"#{key}=#{v}"
|
||||
}.join(", ")
|
||||
}.join(", ")
|
||||
elsif %r{/$} =~ req.request_uri.to_s
|
||||
res.body = ""
|
||||
res.body << req.request_uri.to_s << "\n"
|
||||
res.body << req.script_name
|
||||
else
|
||||
res.body = req.script_name
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue