Commit 5cc66ff2 by rfkelly0

DAVFS: never issue PROPFIND with empty body.

This enumerates all properties and their values and can be very expensive.
parent 3858a817
...@@ -107,7 +107,8 @@ class DAVFS(FS): ...@@ -107,7 +107,8 @@ class DAVFS(FS):
# Check that the server speaks WebDAV, and normalize the URL # Check that the server speaks WebDAV, and normalize the URL
# after any redirects have been followed. # after any redirects have been followed.
self.url = url self.url = url
resp = self._request("/","PROPFIND","",{"Depth":"0"}) pf = propfind(prop="<prop xmlns='DAV:'><resourcetype /></prop>")
resp = self._request("/","PROPFIND",pf.render(),{"Depth":"0"})
try: try:
if resp.status == 404: if resp.status == 404:
raise ResourceNotFoundError("/",msg="root url gives 404") raise ResourceNotFoundError("/",msg="root url gives 404")
...@@ -329,7 +330,8 @@ class DAVFS(FS): ...@@ -329,7 +330,8 @@ class DAVFS(FS):
return RemoteFileBuffer(self,path,mode,contents) return RemoteFileBuffer(self,path,mode,contents)
def exists(self,path): def exists(self,path):
response = self._request(path,"PROPFIND","",{"Depth":"0"}) pf = propfind(prop="<prop xmlns='DAV:'><resourcetype /></prop>")
response = self._request(path,"PROPFIND",pf.render(),{"Depth":"0"})
response.close() response.close()
if response.status == 207: if response.status == 207:
return True return True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment