[EMAIL PROTECTED] wrote: > On Tue, Feb 03, 2004 at 11:09:31AM -0500, Geoffrey Young wrote: > >>I don't see why you need to use either with internal_redirect() - just pass >>it the URI and let Apache handle it. you would use a subrequest (initiated >>from eather of the lookup functions) along with $sub->run() if you wanted to >>send the contents of the subrequest along. > > (For the archives since It might be useful info.. them again maybe not.:-) > Well, I was hoping this was the case however this is what happens.. > [...] > $sub = $r->lookup_file("randfile.html"); > $filename = $sub->filename(); > [...] > $sub->internal_redirect($filename); > $sub->run() and return 'OK'; > > if($sub->run ne 'OK') { > > $sub->log_error("Error running subrequest!"); > > } > Just tried this and I get the usual file_not_found page.. > Not Found > > The requested URL /var/www/htdocs/test/randfile.html was not found on this server. > FYI: > If one uses the internal_redir* with lookup_file() the above err is what occurs. > If one uses the internal_redir* with lookup_uri() and the file exists > one does get the page. So me thinks I am missing something obvious. Is it? > thought train was that subrequests make Apache reload the page as if it was > a completely new request. That way redirection would occur simularly to > META tags redirection when set to "0" seconds. Well back to it.
take a look at the internal_redirect docs - once you call internal_redirect you need to return OK - no additional logic is allowed. so, you can't both $sub->internal_redirect() and $sub->run(). basically, if in your content handler you want Apache to redirect to a different URI use $r->internal_redirect. if you want to test attributes of a given URI or file (say, whether the current $r->remote_user would be able to view the file if they accessed it directly), then you would create a subrequest with lookup_file() or lookup_uri(). if you find that the subrequest passes your tests, you can $sub->run() to send the file directly to the client, or call whatever logic you like to send your own content to the client (including $r->internal_redirect). HTH --Geoff -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html