mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/net/http/generic_request.rb (Net::HTTPGenericRequest):
set content-length to zero on empty post requests by Gregory Ostermayr <gregory.ostermayr@gmail.com> https://github.com/ruby/ruby/pull/201 fix GH-201 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0f9b33c793
commit
02253a7961
3 changed files with 19 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
|||
Mon Dec 24 04:56:48 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* lib/net/http/generic_request.rb (Net::HTTPGenericRequest):
|
||||
set content-length to zero on empty post requests
|
||||
by Gregory Ostermayr <gregory.ostermayr@gmail.com>
|
||||
https://github.com/ruby/ruby/pull/201 fix GH-201
|
||||
|
||||
Sun Dec 23 19:09:16 2012 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* thread.c: rename methods:
|
||||
|
|
|
@ -89,6 +89,9 @@ class Net::HTTPGenericRequest
|
|||
def set_body_internal(str) #:nodoc: internal use only
|
||||
raise ArgumentError, "both of body argument and HTTPRequest#body set" if str and (@body or @body_stream)
|
||||
self.body = str if str
|
||||
if @body.nil? && @body_stream.nil? && @body_data.nil? && request_body_permitted?
|
||||
self.body = ''
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -310,6 +310,7 @@ module TestNetHTTP_version_1_1_methods
|
|||
start {|http|
|
||||
_test_post__base http
|
||||
_test_post__file http
|
||||
_test_post__no_data http
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -332,6 +333,14 @@ module TestNetHTTP_version_1_1_methods
|
|||
assert_equal data, f.string
|
||||
end
|
||||
|
||||
def _test_post__no_data(http)
|
||||
unless self.is_a?(TestNetHTTP_v1_2_chunked)
|
||||
data = nil
|
||||
res = http.post('/', data)
|
||||
assert_not_equal '411', res.code
|
||||
end
|
||||
end
|
||||
|
||||
def test_s_post_form
|
||||
url = "http://#{config('host')}:#{config('port')}/"
|
||||
res = Net::HTTP.post_form(
|
||||
|
|
Loading…
Add table
Reference in a new issue