diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-14 17:48:09 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-14 17:48:09 +0000 |
commit | edf505a7e8d52970a2a1ae29ab450abf3819a63b (patch) | |
tree | b1b33b3f1332572d8394ad0b8f3f76952909c604 | |
parent | 61b9d4a288361bd055df346cdde4bb970c7406a3 (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_3@56782 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 02:45:44 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 01:05:45 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org> * object.c: Improve documentation for Float conversion. diff --git a/lib/net/http.rb b/lib/net/http.rb index bc01b29bff..84951c7697 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -1436,7 +1436,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 a7eaca4f74..f6296bded9 100644 --- a/test/net/http/test_http.rb +++ b/test/net/http/test_http.rb @@ -894,6 +894,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.3.2" #define RUBY_RELEASE_DATE "2016-11-15" -#define RUBY_PATCHLEVEL 213 +#define RUBY_PATCHLEVEL 214 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 11 |