Aaron Gallagher
habnabit at gmail.com
Tue May 29 22:06:20 EDT 2007
On May 29, 2007, at 4:23 PM, Graham Dumpleton wrote: > On 30/05/07, Aaron Gallagher <habnabit at gmail.com> wrote: >> Also, I seem to actually be having bizarre problems with my >> redirects. When I request /a/b/c/d/, my handler catches the bad URL >> and executes this code: >> req.internal_redirect('/?__404') >> return apache.DONE >> >> What happens is I get a page that has a text/plain mime type with a >> 200 response code that looks essentially like this (stripping out a >> lot of HTML): >> Page not found: /d/ >> Page not found: /c/d/ >> Page not found: /b/c/d/ >> Page not found: /a/b/c/d/ >> >> I found that after the redirect, the handler (which is a >> fixuphandler) doesn't recur, but return apache.DONE, and then another >> handler is called. My only thought could be that this is intrinsic to >> the fixuphandler, but that seems silly. Skipping the redirect and >> just returning 404 seems to work, and it doesn't return four not >> found pages. >> >> What do I need to do to fix this? > > This is probably the problem with autoindex I briefly mentioned. To do > an index it actually does a sub request as far as the fixup handler > phase for every item which it might list in the index to determine if > it has access rights and should be listing it. If you have handlers > for these phases it will trigger them for the subrequest as well which > might cause issues. One can detect if such a handler is called in > subrequest by looking whether req.prev or req.main (cant remember > which), is not None. I just tried this, and whenever I tried to access req.prev or req.main (even req.next), the request would be scrapped and a new one created, that would get to the same point before starting again. I would have thousands of lines of "Debug: preparing to redirect" before I would just have to cancel the page from loading. > When I get a chance to at least get directory index to week as you > indicate what you want, then we can start stepping through these > others issues. > > Graham Aaron Gallagher <habnabit at gmail.com>
|