Webdav -- GET on a directory
Posted
by Joe Cannatti
on Stack Overflow
See other posts from Stack Overflow
or by Joe Cannatti
Published on 2010-06-11T15:49:49Z
Indexed on
2010/06/11
15:52 UTC
Read the original article
Hit count: 357
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
© Stack Overflow or respective owner