summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-14 17:48:09 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-14 17:48:09 +0000
commitedf505a7e8d52970a2a1ae29ab450abf3819a63b (patch)
treeb1b33b3f1332572d8394ad0b8f3f76952909c604 /test
parent61b9d4a288361bd055df346cdde4bb970c7406a3 (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
Diffstat (limited to 'test')
-rw-r--r--test/net/http/test_http.rb33
1 files changed, 33 insertions, 0 deletions
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',