summaryrefslogtreecommitdiff
path: root/test/net/http/test_http.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/net/http/test_http.rb')
-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 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',