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.

Florent

+    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/http.py and it just sets the Location to what it is told to ('.', 'somemethod.html')

/JM

OK, that's the one in Zope3/src/zope/publisher/browser.py 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]
           else:
               base += '/'
           location = base + location
# TODO: HTTP redirects must provide an absolute location, see # http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30 # 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)

/JM


_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to