summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--lib/net/http.rb3
-rw-r--r--test/net/http/test_http.rb11
-rw-r--r--version.h6
4 files changed, 26 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index faeb6398eb..69f2facd6d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Thu Jan 22 17:30:33 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+
+ * lib/net/http.rb (Net::HTTP#send_request): there is no response body
+ with HEAD request. Patch by @rodrigosaito [fix GH-520]
+
+Thu Jan 22 17:30:33 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
+
+ * test/net/http/test_http.rb (_test_send_request__HEAD): Added
+ failing test for send_request with HEAD method.
+
Wed Jan 14 16:53:14 2015 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
* ext/tk/lib/tkextlib/tcllib/plotchart.rb: fix to invoke correct function
diff --git a/lib/net/http.rb b/lib/net/http.rb
index 1e481ed366..5c827c3869 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -1348,7 +1348,8 @@ module Net #:nodoc:
# puts response.body
#
def send_request(name, path, data = nil, header = nil)
- r = HTTPGenericRequest.new(name,(data ? true : false),true,path,header)
+ has_response_body = name != 'HEAD'
+ r = HTTPGenericRequest.new(name,(data ? true : false),has_response_body,path,header)
request r, data
end
diff --git a/test/net/http/test_http.rb b/test/net/http/test_http.rb
index 0a0b6ca809..527b7b6f05 100644
--- a/test/net/http/test_http.rb
+++ b/test/net/http/test_http.rb
@@ -574,6 +574,7 @@ module TestNetHTTP_version_1_2_methods
def test_send_request
start {|http|
_test_send_request__GET http
+ _test_send_request__HEAD http
_test_send_request__POST http
}
end
@@ -588,6 +589,16 @@ module TestNetHTTP_version_1_2_methods
assert_equal $test_net_http_data, res.body
end
+ def _test_send_request__HEAD(http)
+ res = http.send_request('HEAD', '/')
+ assert_kind_of Net::HTTPResponse, res
+ unless self.is_a?(TestNetHTTP_v1_2_chunked)
+ assert_not_nil res['content-length']
+ assert_equal $test_net_http_data.size, res['content-length'].to_i
+ end
+ assert_nil res.body
+ end
+
def _test_send_request__POST(http)
data = 'aaabbb cc ddddddddddd lkjoiu4j3qlkuoa'
res = http.send_request('POST', '/', data, 'content-type' => 'application/x-www-form-urlencoded')
diff --git a/version.h b/version.h
index f596e9c185..059388b0a0 100644
--- a/version.h
+++ b/version.h
@@ -1,10 +1,10 @@
#define RUBY_VERSION "2.0.0"
-#define RUBY_RELEASE_DATE "2015-01-14"
-#define RUBY_PATCHLEVEL 614
+#define RUBY_RELEASE_DATE "2015-01-22"
+#define RUBY_PATCHLEVEL 615
#define RUBY_RELEASE_YEAR 2015
#define RUBY_RELEASE_MONTH 1
-#define RUBY_RELEASE_DAY 14
+#define RUBY_RELEASE_DAY 22
#include "ruby/version.h"