diff options
author | Damien Churchill <damien.churchill@ukplc.net> | 2011-05-03 19:05:04 +0100 |
---|---|---|
committer | Damien Churchill <damien.churchill@ukplc.net> | 2011-05-03 19:05:15 +0100 |
commit | d362a6ceba9c96c91ee7a25bccd1eab36e0fd5c1 (patch) | |
tree | 90b1ffd3412fb5fbcfe9fb5046d753f42fc27f29 /deluge/ui/web/server.py | |
parent | 138b8ae3146e030c97b42e451b2ec200fa39053d (diff) | |
download | deluge-d362a6ceba9c96c91ee7a25bccd1eab36e0fd5c1.tar.gz deluge-d362a6ceba9c96c91ee7a25bccd1eab36e0fd5c1.tar.bz2 deluge-d362a6ceba9c96c91ee7a25bccd1eab36e0fd5c1.zip |
fix the path given by the set-cookie header
Diffstat (limited to 'deluge/ui/web/server.py')
-rw-r--r-- | deluge/ui/web/server.py | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/deluge/ui/web/server.py b/deluge/ui/web/server.py index bb7b12da8..ee03e85e0 100644 --- a/deluge/ui/web/server.py +++ b/deluge/ui/web/server.py @@ -518,13 +518,31 @@ class TopLevel(resource.Resource): self.__scripts.remove(script) self.__debug_scripts.remove(script) - def getChild(self, path, request): if path == "": return self else: return resource.Resource.getChild(self, path, request) + def getChildWithDefault(self, path, request): + # Calculate the request base + header = request.getHeader('x-deluge-base') + base = header if header else component.get("DelugeWeb").base + + # validate the base parameter + if not base: + base = '/' + + if base[0] != '/': + base = '/' + base + + if base[-1] != '/': + base += '/' + + request.base = base.encode('idna') + + return resource.Resource.getChildWithDefault(self, path, request) + def render(self, request): debug = False if 'debug' in request.args: @@ -555,25 +573,12 @@ class TopLevel(resource.Resource): template = Template(filename=rpath("index.html")) request.setHeader("content-type", "text/html; charset=utf-8") - header = request.getHeader('x-deluge-base') - base = header if header else component.get("DelugeWeb").base - - # validate the base parameter - if not base: - base = '/' - - if base[0] != '/': - base = '/' + base - - if base[-1] != '/': - base += '/' - web_config = component.get("Web").get_config() - web_config["base"] = base + web_config["base"] = request.base config = dict([(key, web_config[key]) for key in UI_CONFIG_KEYS]) js_config = common.json.dumps(config) return template.render(scripts=scripts, stylesheets=self.stylesheets, - debug=debug, base=base, js_config=js_config) + debug=debug, base=request.base, js_config=js_config) class ServerContextFactory: |