summaryrefslogtreecommitdiff
path: root/addons/document_webdav/webdav_server.py
diff options
context:
space:
mode:
authorP. Christeas <p_christ@hol.gr>2010-09-26 19:32:10 +0300
committerP. Christeas <p_christ@hol.gr>2010-09-26 19:32:10 +0300
commit329c9a003ce4702f3589555fe18cf42a198678d6 (patch)
tree75c0413aa51e8c0e03e299036aaedd780775c2f7 /addons/document_webdav/webdav_server.py
parentb5f6eafe663489b0bc8fe4808fe08da7425d6870 (diff)
Doc WebDAV: reuse address from the socket, not the bind server.
This should solve the following: When we reply to PROPFIND requests etc, we provide the absolute url of ourselves like: <D:href>http://our.server:8069/webdav/mydb/Documents</D:href> The problem is that if we bind to 0.0.0.0 and the interface, which the client connects through, doesn't resolve from "our.server", then we are practically redirecting the client to the wrong address. This is expected to happen at openerp servers w/o full qualified names and reverse resolution of their interfaces. Requires server patch (at websrv_lib) to function, fallbacks to old code on trouble. bzr revid: p_christ@hol.gr-20100926163210-v8scuvhg991jbbzc
Diffstat (limited to 'addons/document_webdav/webdav_server.py')
-rw-r--r--addons/document_webdav/webdav_server.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/addons/document_webdav/webdav_server.py b/addons/document_webdav/webdav_server.py
index 44592243480..1c9009b0316 100644
--- a/addons/document_webdav/webdav_server.py
+++ b/addons/document_webdav/webdav_server.py
@@ -81,7 +81,12 @@ class DAVHandler(HttpOptions, FixSendError, DAVRequestHandler):
def setup(self):
self.davpath = '/'+config.get_misc('webdav','vdir','webdav')
- self.baseuri = "http://%s:%d/"% (self.server.server_name, self.server.server_port)
+ addr, port = self.server.server_name, self.server.server_port
+ try:
+ addr, port = self.request.getsockname()
+ except Exception, e:
+ self.log_error("Cannot calculate own address:" , e)
+ self.baseuri = "http://%s:%d/"% (addr, port)
self.IFACE_CLASS = openerp_dav_handler(self, self.verbose)
def copymove(self, CLASS):