Commit 371dbaa6 authored by Ivan Tyagov's avatar Ivan Tyagov

Even though we detect a Redirect code not always we can rely that server will...

Even though we detect a Redirect code not always we can rely that server will send a correct location header. 
Be more robust and add a basic check. 


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25868 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f901ed5a
...@@ -354,14 +354,15 @@ class WizardTool(BaseTool): ...@@ -354,14 +354,15 @@ class WizardTool(BaseTool):
if f.code> 300 and f.code <400: if f.code> 300 and f.code <400:
# adjust return url which my contain proxy URLs as arguments # adjust return url which my contain proxy URLs as arguments
location = metadata.getheader('location') location = metadata.getheader('location')
parsed_url = list(urlparse(location)) if location is not None:
local_site_url_prefix = urllib.quote('%s/portal_wizard/proxy' \ parsed_url = list(urlparse(location))
%self.getPortalObject().absolute_url()) local_site_url_prefix = urllib.quote('%s/portal_wizard/proxy' \
remote_url_parsed = urlparse(self.getServerUrl()) %self.getPortalObject().absolute_url())
remote_site_url_prefix = '%s://%s/kb' %(remote_url_parsed[0], remote_url_parsed[1]) remote_url_parsed = urlparse(self.getServerUrl())
# fix arguments for returned location URL remote_site_url_prefix = '%s://%s/kb' %(remote_url_parsed[0], remote_url_parsed[1])
parsed_url[4] = parsed_url[4].replace(local_site_url_prefix, remote_site_url_prefix) # fix arguments for returned location URL
response['location'] = urlunparse(parsed_url) parsed_url[4] = parsed_url[4].replace(local_site_url_prefix, remote_site_url_prefix)
response['location'] = urlunparse(parsed_url)
response.setStatus(f.code, f.msg) response.setStatus(f.code, f.msg)
response.setHeader('content-type', metadata.getheader('content-type')) response.setHeader('content-type', metadata.getheader('content-type'))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment