Doc Webdav: Don't send both ETag and Location after PUT
authorP. Christeas <p_christ@hol.gr>
Thu, 12 Aug 2010 11:10:25 +0000 (14:10 +0300)
committerP. Christeas <p_christ@hol.gr>
Thu, 12 Aug 2010 11:10:25 +0000 (14:10 +0300)
An ETag should refer to the requested uri, so a Location header will
render it invalid anyway. Gnome's evolution has an if-else block that
first checks ETag and then Location.

bzr revid: p_christ@hol.gr-20100812111025-xoilqlb956moovgv

addons/document_webdav/webdav_server.py

index 3cda2cc..8a83e25 100644 (file)
@@ -221,14 +221,14 @@ class DAVHandler(HttpOptions, FixSendError, DAVRequestHandler):
             # note that we have allowed for > 2 elems
         if location:
             headers['Location'] = location
-
-        try:
-            if not etag:
-                etag = dc.get_prop(location or uri, "DAV:", "getetag")
-            if etag:
-                headers['ETag'] = str(etag)
-        except Exception:
-            pass
+        else:
+            try:
+                if not etag:
+                    etag = dc.get_prop(location or uri, "DAV:", "getetag")
+                if etag:
+                    headers['ETag'] = str(etag)
+            except Exception:
+                pass
 
         self.send_body(None, '201', 'Created', '', headers=headers)