Webdav -- GET on a directory
- by Joe Cannatti
I am beginning to build a tool that uses WebDAV. I am having trouble wrapping my head around something here. I think I am missing something conceptual. I can use PUT's to add files to the server. I can use GET's to read files from the server, but when I try to use GET on a directory I get a 403:Forbidden. I am using basic authentication. My code in MacRuby is as follows
Net::HTTP.start('localhost') do |http|
res = Net::HTTP::Get.new('http://localhost/webdav/')
res.basic_auth 'jcannatti', 'webdav'
http.request res
end
this returns
<Net::HTTPForbidden 403 Forbidden readbody=true>
however this
Net::HTTP.start('localhost') do |http|
res = Net::HTTP::Put.new('http://localhost/webdav/gorilla.txt')
res.body = "testetsetest"
res.basic_auth 'jcannatti', 'webdav'
http.request res
end
returns
<Net::HTTPCreated 201 Created readbody=true>
What should happen when calling a GET on a WebDAV directory when everything is working correctly?
thanks