diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-20 05:57:10 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-20 05:57:10 +0000 |
commit | d82504dd0ff56d67e009f6c2d23fdcd60e6ce024 (patch) | |
tree | 3e4ce836227963e90575ff452cb6b8c2a0a29d35 | |
parent | 512ebc410458ff1d182c9faaa5ee325ead256e27 (diff) | |
download | ruby-d82504dd0ff56d67e009f6c2d23fdcd60e6ce024.tar.gz |
* lib/net/http.rb: Fixed regression for Net::HTTP::PUT with "Expect-100"
header.
* test/net/http/test_http.rb: added test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | lib/net/http.rb | 6 | ||||
-rw-r--r-- | test/net/http/test_http.rb | 16 |
3 files changed, 25 insertions, 3 deletions
@@ -1,3 +1,9 @@ +Fri Nov 20 14:57:01 2015 Trevor Rowe <trevorrowe@gmail.com> + + * lib/net/http.rb: Fixed regression for Net::HTTP::PUT with "Expect-100" + header. + * test/net/http/test_http.rb: added test. + Fri Nov 20 14:39:56 2015 SHIBATA Hiroshi <hsbt@ruby-lang.org> * lib/net/http.rb: set hostname before call ossl_ssl_set_session. diff --git a/lib/net/http.rb b/lib/net/http.rb index d29a2d81cb..5ccf653d37 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -1439,11 +1439,11 @@ module Net #:nodoc: res.uri = req.uri - res.reading_body(@socket, req.response_body_permitted?) { - yield res if block_given? - } res } + res.reading_body(@socket, req.response_body_permitted?) { + yield res if block_given? + } rescue Net::OpenTimeout raise rescue Net::ReadTimeout, IOError, EOFError, diff --git a/test/net/http/test_http.rb b/test/net/http/test_http.rb index 1bd085a90b..cfdf62191f 100644 --- a/test/net/http/test_http.rb +++ b/test/net/http/test_http.rb @@ -838,6 +838,22 @@ class TestNetHTTPContinue < Test::Unit::TestCase assert_not_match(/HTTP\/1.1 100 continue/, @debug.string) end + def test_expect_continue_error_before_body + @log_tester = nil + mount_proc {|req, res| + raise WEBrick::HTTPStatus::Forbidden + } + start {|http| + uheader = {'content-length' => '5', 'expect' => '100-continue'} + http.continue_timeout = 1 # allow the server to respond before sending + http.request_post('/continue', 'data', uheader) {|res| + assert_equal(res.code, '403') + } + } + assert_match(/Expect: 100-continue/, @debug.string) + assert_not_match(/HTTP\/1.1 100 continue/, @debug.string) + end + def test_expect_continue_error_while_waiting mount_proc {|req, res| res.status = 501 |