mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merge revision(s) 55731: [Backport #12610]
* lib/webrick/httpservlet/cgihandler.rb (do_GET): delete HTTP_PROXY * test/webrick/test_cgi.rb (test_cgi_env): new test * test/webrick/webrick.cgi (do_GET): new endpoint to dump env [ruby-core:76511] [Bug #12610] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@55923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e4d360608e
commit
89594c0370
5 changed files with 26 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
|||
Tue Aug 16 13:40:26 2016 Eric Wong <e@80x24.org>
|
||||
|
||||
* lib/webrick/httpservlet/cgihandler.rb (do_GET): delete HTTP_PROXY
|
||||
* test/webrick/test_cgi.rb (test_cgi_env): new test
|
||||
* test/webrick/webrick.cgi (do_GET): new endpoint to dump env
|
||||
[ruby-core:76511] [Bug #12610]
|
||||
|
||||
Tue Aug 16 13:38:36 2016 Kouhei Sutou <kou@cozmixng.org>
|
||||
|
||||
* lib/rexml/attribute.rb (REXML::Attribute#to_string): Fix wrong
|
||||
|
|
|
@ -51,6 +51,7 @@ module WEBrick
|
|||
meta = req.meta_vars
|
||||
meta["SCRIPT_FILENAME"] = @script_filename
|
||||
meta["PATH"] = @config[:CGIPathEnv]
|
||||
meta.delete("HTTP_PROXY")
|
||||
if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
|
||||
meta["SystemRoot"] = ENV["SystemRoot"]
|
||||
end
|
||||
|
|
|
@ -109,6 +109,20 @@ class TestWEBrickCGI < Test::Unit::TestCase
|
|||
}
|
||||
end
|
||||
|
||||
def test_cgi_env
|
||||
start_cgi_server do |server, addr, port, log|
|
||||
http = Net::HTTP.new(addr, port)
|
||||
req = Net::HTTP::Get.new("/webrick.cgi/dumpenv")
|
||||
req['proxy'] = 'http://example.com/'
|
||||
req['hello'] = 'world'
|
||||
http.request(req) do |res|
|
||||
env = Marshal.load(res.body)
|
||||
assert_equal 'world', env['HTTP_HELLO']
|
||||
assert_not_operator env, :include?, 'HTTP_PROXY'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
CtrlSeq = [0x7f, *(1..31)].pack("C*").gsub(/\s+/, '')
|
||||
CtrlPat = /#{Regexp.quote(CtrlSeq)}/o
|
||||
DumpPat = /#{Regexp.quote(CtrlSeq.dump[1...-1])}/o
|
||||
|
|
|
@ -4,7 +4,9 @@ require "webrick/cgi"
|
|||
class TestApp < WEBrick::CGI
|
||||
def do_GET(req, res)
|
||||
res["content-type"] = "text/plain"
|
||||
if (p = req.path_info) && p.length > 0
|
||||
if req.path_info == "/dumpenv"
|
||||
res.body = Marshal.dump(ENV.to_hash)
|
||||
elsif (p = req.path_info) && p.length > 0
|
||||
res.body = p
|
||||
elsif (q = req.query).size > 0
|
||||
res.body = q.keys.sort.collect{|key|
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#define RUBY_VERSION "2.2.6"
|
||||
#define RUBY_RELEASE_DATE "2016-08-16"
|
||||
#define RUBY_PATCHLEVEL 351
|
||||
#define RUBY_PATCHLEVEL 352
|
||||
|
||||
#define RUBY_RELEASE_YEAR 2016
|
||||
#define RUBY_RELEASE_MONTH 8
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue