summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-01 12:30:52 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-01 12:30:52 +0000
commitab70e53ac3b5102d4ecbe8f38d4f76afad29d37d ()
tree6c68653e33e9f6a1c8e74d96669e058952bd60e9
parentb64083376ef9fdd04ea48d7b4002934ab4f921b9 (diff)
* lib/net/http.rb: adding support to rfc5789 verb.
Added a Net::HTTP:: class which expects a message body and response body. It recycles the post method into a one, that will send the encoded representation to the server. Summarizing, a new class has been created, the post method extracted into send_entity, including a new argument, which defines which class to use (Post or ) and finally a method was created. [ruby-core:30426] ed by Guilherme Silveira <guilherme.silveira AT caelum.com.br> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog13
-rw-r--r--lib/net/http.rb42
-rw-r--r--test/net/http/test_http.rb19
-rw-r--r--test/net/http/utils.rb6
4 files changed, 70 insertions, 10 deletions
@@ -1,3 +1,16 @@
Tue Jun 1 03:46:08 2010 NARUSE, Yui <[email protected]>
* ext/readline/extconf.rb: reject GPLv3 readline. [ruby-dev:39172]
@@ -966,16 +966,13 @@ module Net #:nodoc:
# "application/x-www-form-urlencoded" by default.
#
def post(path, data, initheader = nil, dest = nil, &block) # :yield: +body_segment+
- res = nil
- request(Post.new(path, initheader), data) {|r|
- r.read_body dest, &block
- res = r
- }
- unless @newimpl
- res.value
- return res, res.body
- end
- res
end
def put(path, data, initheader = nil) #:nodoc:
@@ -1176,6 +1173,21 @@ module Net #:nodoc:
private
def transport_request(req)
begin_transport req
req.exec @socket, @curr_http_version, edit_path(req.path)
@@ -1832,6 +1844,16 @@ module Net #:nodoc:
end
#
# WebDAV methods --- RFC2518
#
@@ -169,6 +169,25 @@ module TestNetHTTP_version_1_1_methods
assert_equal ["a=x1", "a=x2", "b=y"], res.body.split(/[;&]/).sort
end
end
@@ -92,6 +92,12 @@ module TestNetHTTPUtils
res.body = req.body
res.chunked = @chunked
end
end
class NullWriter