You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by Mike Glover <mp...@janrain.com> on 2006/09/14 19:59:01 UTC

Bizarre behavior with util.redirect() and mod_autoindex

I'm working on an OpenID access control using mod_python.  As part of the OpenID protocol, our code redirects (302) attempted access to a login page.  Works Great.

However.  If I try to use mod_autoindex to view a directory, and some of the files in that directory have OpenID access control enabled, I get a page that looks like the attached image.

What's Happening?  mod_autoindex is spawning an internal subrequest for each file in the directory.  For the access controlled files, util.redirect() is being called as part of that subrequest.  util.redirect() automatically outputs the 'the document has moved here' language directly to the client.

I solved this in our app by not generating the 302 if req.main != None.  I don't think I should have to worry about that (though I'm willing to be convinced).  util.redirect() should recognize the internal request and not write output to the client.

I'll happily submit a patch against util.py if folks here think it helpful.

-mike

-mike