← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~ed.so/duplicity/0.6-webdav_fixes into lp:duplicity

 

edso has proposed merging lp:~ed.so/duplicity/0.6-webdav_fixes into lp:duplicity.

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~ed.so/duplicity/0.6-webdav_fixes/+merge/96577
-- 
https://code.launchpad.net/~ed.so/duplicity/0.6-webdav_fixes/+merge/96577
Your team duplicity-team is requested to review the proposed merge of lp:~ed.so/duplicity/0.6-webdav_fixes into lp:duplicity.
=== modified file 'duplicity/backends/webdavbackend.py'
--- duplicity/backends/webdavbackend.py	2011-06-12 13:49:33 +0000
+++ duplicity/backends/webdavbackend.py	2012-03-08 14:12:21 +0000
@@ -51,12 +51,18 @@
 
     webdav backend contributed in 2006 by Jesper Zedlitz <jesper@xxxxxxxxxx>
     """
-    listbody = """\
+    # for better compatibility we send an empty listbody as described in
+    # http://www.ietf.org/rfc/rfc4918.txt
+    # "  A client may choose not to submit a request body.  An empty PROPFIND
+    #    request body MUST be treated as if it were an 'allprop' request.  "
+    # it was retired because e.g. box.net didn't support <D:allprop/>
+    listbody ="" 
+    # the following is the retired listbody, just in case
+    """\
 <?xml version="1.0" encoding="utf-8" ?>
 <D:propfind xmlns:D="DAV:">
 <D:allprop/>
 </D:propfind>
-
 """
 
     """Connect to remote store using WebDAV Protocol"""
@@ -74,7 +80,7 @@
             self.directory = '/'
 
         log.Info("Using WebDAV host %s" % (parsed_url.hostname,))
-        log.Info("Using WebDAV port %s" % (parsed_url.port,))	
+        log.Info("Using WebDAV port %s" % (parsed_url.port,))    
         log.Info("Using WebDAV directory %s" % (self.directory,))
         log.Info("Using WebDAV protocol %s" % (globals.webdav_proto,))
 
@@ -167,12 +173,15 @@
             del self.headers['Depth']
             # if the target collection does not exist, create it.
             if response.status == 404:
+                response.close()
                 log.Info("Directory '%s' being created." % self.directory)
-                res = self.request("MKCOL", self.directory)
-                log.Info("WebDAV MKCOL status: %s %s" % (res.status, res.reason))
+                response = self.request("MKCOL", self.directory)
+                log.Info("WebDAV MKCOL status: %s %s" % (response.status, response.reason))
+                response.close()
                 continue
             if response.status == 207:
                 document = response.read()
+                response.close()
                 break
             log.Info("WebDAV PROPFIND attempt #%d failed: %s %s" % (n, response.status, response.reason))
             if n == globals.num_retries +1:


Follow ups