* 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
This commit is contained in:
hsbt 2015-11-20 05:57:10 +00:00
Родитель 2c97d69052
Коммит f0002bd5a2
3 изменённых файлов: 25 добавлений и 3 удалений

Просмотреть файл

@ -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.

Просмотреть файл

@ -1439,11 +1439,11 @@ module Net #:nodoc:
res.uri = req.uri
res
}
res.reading_body(@socket, req.response_body_permitted?) {
yield res if block_given?
}
res
}
rescue Net::OpenTimeout
raise
rescue Net::ReadTimeout, IOError, EOFError,

Просмотреть файл

@ -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