From 21847b3864632e5e2f99f33b9ea516fa93d00134 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Wed, 3 Nov 2010 13:26:04 +0200 Subject: doc webdav: workaround bug in KHTML's PUT method. This isn't our fault, but KDE is bound to remain broken for quite some time, we'd better support it. bzr revid: p_christ@hol.gr-20101103112604-78mdkva38dx1vm9k --- addons/document_webdav/webdav_server.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'addons/document_webdav/webdav_server.py') diff --git a/addons/document_webdav/webdav_server.py b/addons/document_webdav/webdav_server.py index df2c4a871f6..52356596af0 100644 --- a/addons/document_webdav/webdav_server.py +++ b/addons/document_webdav/webdav_server.py @@ -36,10 +36,13 @@ from service.websrv_lib import HTTPDir, FixSendError, HttpOptions from BaseHTTPServer import BaseHTTPRequestHandler import urlparse import urllib +import re from string import atoi,split from DAV.errors import * # from DAV.constants import DAV_VERSION_1, DAV_VERSION_2 +khtml_re = re.compile(r' KHTML/([0-9\.]+) ') + def OpenDAVConfig(**kw): class OpenDAV: def __init__(self, **kw): @@ -131,6 +134,16 @@ class DAVHandler(HttpOptions, FixSendError, DAVRequestHandler): # the BufferingHttpServer will send Connection: close , while # the BaseHTTPRequestHandler will only accept int code. # workaround both of them. + if self.command == 'PROPFIND' and int(code) == 404: + kh = khtml_re.search(self.headers.get('User-Agent','')) + if kh and (kh.group(1) < '4.5'): + # There is an ugly bug in all khtml < 4.5.x, where the 404 + # response is treated as an immediate error, which would even + # break the flow of a subsequent PUT request. At the same time, + # the 200 response (rather than 207 with content) is treated + # as "path not exist", so we send this instead + # https://bugs.kde.org/show_bug.cgi?id=166081 + code = 200 BaseHTTPRequestHandler.send_response(self, int(code), message) def send_header(self, key, value): -- cgit v1.2.3 From 3389c99ee670a59571def5d1ac670d521ce7d6b5 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Fri, 12 Nov 2010 17:19:46 +0530 Subject: [Fix] caldav,document,document_ftp,document_webdav: fix buildbot warnings bzr revid: sbh@tinyerp.com-20101112114946-u19wkxzh1vj33sol --- addons/document_webdav/webdav_server.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'addons/document_webdav/webdav_server.py') diff --git a/addons/document_webdav/webdav_server.py b/addons/document_webdav/webdav_server.py index 4e10c84b8f5..0e5973c95b3 100644 --- a/addons/document_webdav/webdav_server.py +++ b/addons/document_webdav/webdav_server.py @@ -28,7 +28,6 @@ import netsvc -import tools from dav_fs import openerp_dav_handler from tools.config import config from DAV.WebDAVServer import DAVRequestHandler @@ -37,7 +36,7 @@ from BaseHTTPServer import BaseHTTPRequestHandler import urlparse import urllib import re -from string import atoi,split +from string import atoi from DAV.errors import * # from DAV.constants import DAV_VERSION_1, DAV_VERSION_2 @@ -99,7 +98,6 @@ class DAVHandler(HttpOptions, FixSendError, DAVRequestHandler): """ Our uri scheme removes the /webdav/ component from there, so we need to mangle the header, too. """ - dest = self.headers['Destination'] up = urlparse.urlparse(urllib.unquote(self.headers['Destination'])) if up.path.startswith(self.davpath): self.headers['Destination'] = up.path[len(self.davpath):] -- cgit v1.2.3