Find transaction ids for internal redirects
authorSimo Sorce <simo@redhat.com>
Fri, 6 Mar 2015 17:12:00 +0000 (12:12 -0500)
committerSimo Sorce <simo@redhat.com>
Fri, 6 Mar 2015 20:15:31 +0000 (15:15 -0500)
On internal redirections, such as when ErrorDocument is used to
redirect on failed negotiate authentication we need to look harder
for the transaction id.

Ticket: #74

Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Nathan Kinder <nkinder@redhat.com>
ipsilon/util/page.py

index f4e53d6..50585ca 100644 (file)
@@ -138,9 +138,15 @@ class Page(Endpoint):
             # Try with kwargs first
             tid = t.find_tid(kwargs)
             if not tid:
             # Try with kwargs first
             tid = t.find_tid(kwargs)
             if not tid:
-                # If no TID yet See if we have it in a referer
+                # If no TID yet See if we have it in a referer or in the
+                # environment in the REDIRECT_URL
+                url = None
                 if 'referer' in cherrypy.request.headers:
                 if 'referer' in cherrypy.request.headers:
-                    r = urlparse(unquote(cherrypy.request.headers['referer']))
+                    url = cherrypy.request.headers['referer']
+                elif 'REQUEST_URI' in cherrypy.request.wsgi_environ:
+                    url = cherrypy.request.wsgi_environ['REQUEST_URI']
+                if url:
+                    r = urlparse(unquote(url))
                     if r.query:
                         tid = t.find_tid(parse_qs(r.query))
                 if not tid:
                     if r.query:
                         tid = t.find_tid(parse_qs(r.query))
                 if not tid: