You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Bill Moseley <mo...@hank.org> on 2000/10/11 19:25:53 UTC
Why double requests?
mod_perl 1.24/1.3.12 perl 5.6
Here's my httpd.conf:
---------------------
Listen 9000
<VirtualHost *:9000>
<perl>
package My::DirectoryIndex;
use Apache::Constants qw( DECLINED );
sub handler {
my $r = shift;
$r->log_error(
( $r->is_initial_req ? 'initial:' : 'not initial:' )
. $r->uri );
return DECLINED;
}
package My::Hello;
use strict;
use Apache::Constants qw( OK );
sub handler {
my $r = shift;
$r->send_http_header('text/plain');
$r->print('hello');
return OK;
}
</perl>
PerlTransHandler My::DirectoryIndex
<Location /test>
Allow from all
SetHandler perl-script
PerlHandler My::Hello
PerlSendHeader on
</Location>
</VirtualHost>
Here's the request:
-------------------
GET /test/abc/123 http/1.0
HTTP/1.1 200 OK
Date: Wed, 11 Oct 2000 17:17:16 GMT
Server: Apache/1.3.12 (Unix) mod_perl/1.24
Connection: close
Content-Type: text/plain
hello
Here's the error_log
--------------------
[Wed Oct 11 10:17:16 2000] [error] initial:/test/abc/123
[Wed Oct 11 10:17:16 2000] [error] not initial:/abc/123
[Wed Oct 11 10:17:16 2000] [error] [client 192.168.0.98] client denied by
server configuration: /usr/local/apache/htdocs/abc
Why the second request with the extra path?
This doesn't generate a second request:
GET /hello/abc/123 http/1.0
HTTP/1.1 403 Forbidden
[Wed Oct 11 10:25:22 2000] [error] initial:/hello/abc/123
[Wed Oct 11 10:25:22 2000] [error] [client 192.168.0.98] client denied by
server configuration: /usr/local/apache/htdocs/hello
Bill Moseley
mailto:moseley@hank.org
Re: modperl Digest 12 Oct 2000 09:31:25 -0000 Issue 209
Posted by Roger Espel Llima <es...@iagora.net>.
Bill Moseley <mo...@hank.org> wrote:
[ ... ]
> PerlTransHandler My::DirectoryIndex
[ ... ]
> GET /test/abc/123 http/1.0
[ ... ]
> --------------------
> [Wed Oct 11 10:17:16 2000] [error] initial:/test/abc/123
> [Wed Oct 11 10:17:16 2000] [error] not initial:/abc/123
> [Wed Oct 11 10:17:16 2000] [error] [client 192.168.0.98] client denied by
> server configuration: /usr/local/apache/htdocs/abc
It's Apache running a subrequest (only as far as the TransHandler I
think, it definitely does not run the ContentHandler) using the
path_info as an URL, to get the "path_translated" variable.
PATH_TRANSLATED is a rather useless leftover from the CGI protocol; if
you don't use it, you can tell mod_perl to skip it and the rest of the
environment setup, with "PerlSetupEnv Off".
If you don't have the very latest mod_perl, you'll probably need a
"PerlSetupEnv Off" inside of each <Directory> block.
--
Roger Espel Llima, espel@iagora.net
http://www.iagora.com/~espel/index.html
Re: Why double requests?
Posted by Doug MacEachern <do...@covalent.net>.
On Wed, 11 Oct 2000, Bill Moseley wrote:
...
> Here's the request:
> -------------------
> GET /test/abc/123 http/1.0
>
> HTTP/1.1 200 OK
> Date: Wed, 11 Oct 2000 17:17:16 GMT
> Server: Apache/1.3.12 (Unix) mod_perl/1.24
> Connection: close
> Content-Type: text/plain
>
> hello
>
> Here's the error_log
> --------------------
> [Wed Oct 11 10:17:16 2000] [error] initial:/test/abc/123
> [Wed Oct 11 10:17:16 2000] [error] not initial:/abc/123
> [Wed Oct 11 10:17:16 2000] [error] [client 192.168.0.98] client denied by
> server configuration: /usr/local/apache/htdocs/abc
>
> Why the second request with the extra path?
because in this case you have path_info data, when %ENV is populated,
ap_add_cgi_vars() calls ap_sub_req_lookup_uri() to resolve
PATH_TRANSLATED.
notice you won't see it with:
PerlSetupEnv Off