aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--lib/net/http.rb6
-rw-r--r--test/net/http/test_http.rb16
3 files changed, 25 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index dd74062d78..a23f40ee9f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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