ruby-changes:43718
From: nagachika <ko1@a...>
Date: Tue, 2 Aug 2016 02:26:40 +0900 (JST)
Subject: [ruby-changes:43718] nagachika:r55791 (ruby_2_3): merge revision(s) 55731: [Backport #12610]
nagachika 2016-08-02 02:26:35 +0900 (Tue, 02 Aug 2016) New Revision: 55791 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55791 Log: 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] Modified directories: branches/ruby_2_3/ Modified files: branches/ruby_2_3/ChangeLog branches/ruby_2_3/lib/webrick/httpservlet/cgihandler.rb branches/ruby_2_3/test/webrick/test_cgi.rb branches/ruby_2_3/test/webrick/webrick.cgi branches/ruby_2_3/version.h Index: ruby_2_3/test/webrick/webrick.cgi =================================================================== --- ruby_2_3/test/webrick/webrick.cgi (revision 55790) +++ ruby_2_3/test/webrick/webrick.cgi (revision 55791) @@ -4,7 +4,9 @@ require "webrick/cgi" https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/webrick/webrick.cgi#L4 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| Index: ruby_2_3/test/webrick/test_cgi.rb =================================================================== --- ruby_2_3/test/webrick/test_cgi.rb (revision 55790) +++ ruby_2_3/test/webrick/test_cgi.rb (revision 55791) @@ -109,6 +109,20 @@ class TestWEBrickCGI < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/webrick/test_cgi.rb#L109 } 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 Index: ruby_2_3/version.h =================================================================== --- ruby_2_3/version.h (revision 55790) +++ ruby_2_3/version.h (revision 55791) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #define RUBY_VERSION "2.3.2" #define RUBY_RELEASE_DATE "2016-08-02" -#define RUBY_PATCHLEVEL 143 +#define RUBY_PATCHLEVEL 144 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 8 Index: ruby_2_3/lib/webrick/httpservlet/cgihandler.rb =================================================================== --- ruby_2_3/lib/webrick/httpservlet/cgihandler.rb (revision 55790) +++ ruby_2_3/lib/webrick/httpservlet/cgihandler.rb (revision 55791) @@ -52,6 +52,7 @@ module WEBrick https://github.com/ruby/ruby/blob/trunk/ruby_2_3/lib/webrick/httpservlet/cgihandler.rb#L52 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 Index: ruby_2_3/ChangeLog =================================================================== --- ruby_2_3/ChangeLog (revision 55790) +++ ruby_2_3/ChangeLog (revision 55791) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1 +Tue Aug 2 01:34:12 2016 Eric Wong <e@8...> + + * 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 2 01:33:11 2016 Shugo Maeda <shugo@r...> * test/ruby/test_refinement.rb: skip Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r55731 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/