diff options
author | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-05 14:13:31 +0000 |
---|---|---|
committer | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-05 14:13:31 +0000 |
commit | 33a06e4acac0cb7f080436507e06c82de45f7b9b (patch) | |
tree | a88d9c25f8344b9bb9caf329b96ebc76b2e7d8d6 | |
parent | a60a899eeb7e751bb47b94c54f1051093db4bc31 (diff) | |
download | ruby-33a06e4acac0cb7f080436507e06c82de45f7b9b.tar.gz |
* lib/net/http.rb: support WebDAV methods, PROPPATCH, LOCK, UNLOCK, OPTIONS, PROPFIND, DELETE, MOVE, COPY, MKCOL. This patch is contributed by Tatsuki Sugiura.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | lib/net/http.rb | 108 |
2 files changed, 114 insertions, 0 deletions
@@ -1,3 +1,9 @@ +Fri Mar 5 23:13:08 2004 Minero Aoki <aamine@loveruby.net> + + * lib/net/http.rb: support WebDAV methods, PROPPATCH, LOCK, + UNLOCK, OPTIONS, PROPFIND, DELETE, MOVE, COPY, MKCOL. + This patch is contributed by Tatsuki Sugiura. + Fri Mar 5 20:58:37 2004 Minero Aoki <aamine@loveruby.net> * lib/net/http.rb: Net::HTTPResponse#response is obsolete. diff --git a/lib/net/http.rb b/lib/net/http.rb index 90b4495380..798083ee4b 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -705,6 +705,60 @@ module Net # :nodoc: res end + # Sends a PROPPATCH request to the +path+ and gets a response, + # as an HTTPResponse object. + def proppatch(path, body, initheader = nil) + request(Proppatch.new(path, initheader), body) + end + + # Sends a LOCK request to the +path+ and gets a response, + # as an HTTPResponse object. + def lock(path, body, initheader = nil) + request(Lock.new(path, initheader), body) + end + + # Sends a UNLOCK request to the +path+ and gets a response, + # as an HTTPResponse object. + def unlock(path, body, initheader = nil) + request(Unlock.new(path, initheader), body) + end + + # Sends a OPTIONS request to the +path+ and gets a response, + # as an HTTPResponse object. + def options(path, initheader = nil) + request(Options.new(path, initheader)) + end + + # Sends a PROPFIND request to the +path+ and gets a response, + # as an HTTPResponse object. + def propfind(path, body = nil, initheader = {'Depth' => '0'}) + request(Propfind.new(path, initheader), body) + end + + # Sends a DELETE request to the +path+ and gets a response, + # as an HTTPResponse object. + def delete(path, initheader = {'Depth' => 'Infinity'}) + request(Delete.new(path, initheader)) + end + + # Sends a MOVE request to the +path+ and gets a response, + # as an HTTPResponse object. + def move(path, initheader = nil) + request(Move.new(path, initheader)) + end + + # Sends a COPY request to the +path+ and gets a response, + # as an HTTPResponse object. + def copy(path, initheader = nil) + request(Copy.new(path, initheader)) + end + + # Sends a MKCOL request to the +path+ and gets a response, + # as an HTTPResponse object. + def mkcol(path, body = nil, initheader = nil) + request(Mkcol.new(path, initheader), body) + end + # Sends a GET request to the +path+ and gets a response, # as an HTTPResponse object. # @@ -1205,6 +1259,60 @@ module Net # :nodoc: RESPONSE_HAS_BODY = true end + class Proppatch < HTTPRequest + METHOD = 'PROPPATCH' + REQUEST_HAS_BODY = true + RESPONSE_HAS_BODY = true + end + + class Lock < HTTPRequest + METHOD = 'LOCK' + REQUEST_HAS_BODY = true + RESPONSE_HAS_BODY = true + end + + class Unlock < HTTPRequest + METHOD = 'UNLOCK' + REQUEST_HAS_BODY = true + RESPONSE_HAS_BODY = true + end + + class Options < HTTPRequest + METHOD = 'OPTIONS' + REQUEST_HAS_BODY = false + RESPONSE_HAS_BODY = false + end + + class Propfind < HTTPRequest + METHOD = 'PROPFIND' + REQUEST_HAS_BODY = true + RESPONSE_HAS_BODY = true + end + + class Delete < HTTPRequest + METHOD = 'DELETE' + REQUEST_HAS_BODY = false + RESPONSE_HAS_BODY = true + end + + class Move < HTTPRequest + METHOD = 'MOVE' + REQUEST_HAS_BODY = false + RESPONSE_HAS_BODY = true + end + + class Copy < HTTPRequest + METHOD = 'COPY' + REQUEST_HAS_BODY = false + RESPONSE_HAS_BODY = true + end + + class Mkcol < HTTPRequest + METHOD = 'MKCOL' + REQUEST_HAS_BODY = true + RESPONSE_HAS_BODY = true + end + end |