Jean-Marc Orliaguet wrote:

Florent Guillaume wrote:

Redirecting to a relative url is illegal in the HTTP spec. You must always use a fully qualified url.


+    redirect_url = REQUEST['HTTP_REFERER'] or '.'
+    RESPONSE.redirect(redirect_url)

OK, but can you raise that one zope3-dev? It is used all over the place in the zope3 code as a standard way or doing redirection, just do a grep on:

$ grep -r  response.redirect Zope3/src

I checked the redirect() method in publisher/ and it just sets the Location to what it is told to ('.', 'somemethod.html')


OK, that's the one in Zope3/src/zope/publisher/ that is used...

   def redirect(self, location, status=None):
       base = getattr(self, '_base', '')
       if base and isRelative(str(location)):
           l = base.rfind('/')
           if l >= 0:
               base = base[:l+1]
               base += '/'
           location = base + location
# TODO: HTTP redirects must provide an absolute location, see # # So, what if location is relative and base is unknown? Uncomment
       #       the following and you'll see that it actually happens.
       # if isRelative(str(location)):
       #     raise AssertionError('Cannot determine absolute location')
return super(BrowserResponse, self).redirect(location, status)


Zope3-dev mailing list

Reply via email to