diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-14 18:40:30 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-14 18:40:30 +0000 |
commit | bb5114bc7e59c494af03f973ba89d7747325f371 (patch) | |
tree | c2de61a5b2966928bc7895d4ff22058570d94ac2 | |
parent | 6140b395585d53ef2f02e81ef08ad58ac5e79e88 (diff) |
merge revision(s) 56596: [Backport #12890]
* lib/net/http.rb (transport_request): other than HTTPContinue
in 1xx (HTTPInformation) also needs to continue. [Bug #12890]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@56787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/net/http.rb | 2 | ||||
-rw-r--r-- | test/net/http/test_http.rb | 33 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 40 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Tue Nov 15 03:39:07 2016 NARUSE, Yui <naruse@ruby-lang.org> + + * lib/net/http.rb (transport_request): other than HTTPContinue + in 1xx (HTTPInformation) also needs to continue. [Bug #12890] + Sat Nov 12 07:48:07 2016 Nobuyoshi Nakada <nobu@ruby-lang.org> * proc.c (mnew_internal): follow the original class, not to loop diff --git a/lib/net/http.rb b/lib/net/http.rb index 58f1095d20..bceee1c069 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -1413,7 +1413,7 @@ module Net #:nodoc: begin res = HTTPResponse.read_new(@socket) res.decode_content = req.decode_content - end while res.kind_of?(HTTPContinue) + end while res.kind_of?(HTTPInformation) res.uri = req.uri diff --git a/test/net/http/test_http.rb b/test/net/http/test_http.rb index 0eabfa70a2..272e7ddcc8 100644 --- a/test/net/http/test_http.rb +++ b/test/net/http/test_http.rb @@ -870,6 +870,39 @@ class TestNetHTTPContinue < Test::Unit::TestCase end end +class TestNetHTTPSwitchingProtocols < Test::Unit::TestCase + CONFIG = { + 'host' => '127.0.0.1', + 'proxy_host' => nil, + 'proxy_port' => nil, + 'chunked' => true, + } + + include TestNetHTTPUtils + + def logfile + @debug = StringIO.new('') + end + + def mount_proc(&block) + @server.mount('/continue', WEBrick::HTTPServlet::ProcHandler.new(block.to_proc)) + end + + def test_info + mount_proc {|req, res| + req.instance_variable_get(:@socket) << "HTTP/1.1 101 Switching Protocols\r\n\r\n" + res.body = req.query['body'] + } + start {|http| + http.continue_timeout = 0.2 + http.request_post('/continue', 'body=BODY') {|res| + assert_equal('BODY', res.read_body) + } + } + assert_match(/HTTP\/1.1 101 Switching Protocols/, @debug.string) + end +end + class TestNetHTTPKeepAlive < Test::Unit::TestCase CONFIG = { 'host' => '127.0.0.1', @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.2.6" #define RUBY_RELEASE_DATE "2016-11-15" -#define RUBY_PATCHLEVEL 392 +#define RUBY_PATCHLEVEL 393 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 11 |