mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
a60a899eeb
commit
33a06e4aca
2 changed files with 114 additions and 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.
|
||||
|
|
108
lib/net/http.rb
108
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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue