-------------8<---------- Start Bug Report ------------8<----------
1. Problem Description:
I'm not sure if this is my interpretation of the documentation or a
real problem with the code. The documentation says:
> If the current request is a sub-request, this method returns a
> blessed reference to the main request structure. If the current
> request is the main request, then this method returns undef.
>
> To figure out whether you are inside a main request or a
> sub-request/internal redirect, use $r->is_initial_req.
"Main" to me says the one that was received by the server over the
internet -- from the client -- ie no matter how many requests deep
we are at any given point, main() always returns the top most item
on the pile. In that case, checking main->is_initial_request should
always be 1 and looking at the uri() should always be what the server
got from the client.
If that's the correct interpretation of what the documentation says,
then I suspect there's a problem within the code as outlined in the
message subject -- main() isn't really main!
I found this particular discrepancy with a structure similar to the
following:
/file1.html:
<BODY>
<!--#include virtual="/file2.html" -->
</BODY>
/file2.html
<BODY>
<!--#include virtual="/bin/form" -->
</BODY>
/bin/form
[does a bunch of stuff and eventually calls $self->request_uri, see below]
Page.pm:
# Page->request_uri()
sub request_uri ($)
{
my ($self) = shift;
print '<!-- is_initial ' . $self->request->is_initial_req . " -->\n";
print '<!-- uri ' . $self->request->uri . " -->\n";
if ($self->request->main)
{
print '<!-- main->is_initial ' . $self->request->main->is_initial_req . "
-->\n";
print '<!-- main->uri ' . $self->request->main->uri . " -->\n";
}
if ($self->request->main->main)
{
print '<!-- main->main->is_initial ' . $self->request->main->main->is_initial_req .
" -->\n";
print '<!-- main->main->uri ' . $self->request->main->main->uri . " -->\n";
}
my ($req) = $self->request;
# Keep going backwards until you find the actual initial request.
$req = $req->main while (!$req->is_initial_req);
print '<!-- req->uri ' . $req->uri . " -->\n";
return $req->uri;
}
The browser's HTML when accessing http://server/file1.html shows:
<!-- is_initial 0 -->
<!-- uri /bin/form -->
<!-- main->is_initial 0 -->
<!-- main->uri /file2.html -->
<!-- main->main->is_initial 1 -->
<!-- main->main->uri /file1.html -->
<!-- req->uri /file1.html -->
2. Used Components and their Configuration:
*** mod_perl version 2.000002
*** using
/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/Apache2/BuildConfig.pm
*** Makefile.PL options:
MP_APR_CONFIG => /usr/bin/apr-1-config
MP_APR_LIB => aprext
MP_APXS => /usr/sbin/apxs
MP_COMPAT_1X => 1
MP_GENERATE_XS => 1
MP_LIBNAME => mod_perl
MP_USE_DSO => 1
*** The httpd binary was not found
*** (apr|apu)-config linking info
-laprutil-1 -lldap -llber -ldb-4.3 -lexpat
-lapr-1 -lpthread -ldl
*** /usr/bin/perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
Platform:
osname=linux, osvers=2.6.9-22.18.bz155725.elsmp,
archname=i386-linux-thread-multi
uname='linux hs20-bc1-6.build.redhat.com 2.6.9-22.18.bz155725.elsmp #1 smp
thu nov 17 15:34:08 est 2005 i686 i686 i386 gnulinux '
config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Dversion=5.8.8 -Dmyhostname=localhost
[EMAIL PROTECTED] -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm
-Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto
-Ud_endservent_r_proto -Ud_setservent_r_proto -Dinc_version_list=5.8.7 5.8.6 5.8.5 5.8.4 5.8.3 -Dscriptdir=/usr/bin'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe
-Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe
-Wdeclaration-after-statement -I/usr/local/include -I/usr/include/gdbm'
ccversion='', gccversion='4.1.0 20060228 (Red Hat 4.1.0-1)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib/libc-2.3.90.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.3.90'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E
-Wl,-rpath,/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES
USE_PERLIO USE_REENTRANT_API
Built under linux
Compiled at Mar 1 2006 18:29:53
%ENV:
PERL_LWP_USE_HTTP_10="1"
@INC:
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.8
/usr/lib/perl5/site_perl/5.8.7
/usr/lib/perl5/site_perl/5.8.6
/usr/lib/perl5/site_perl/5.8.5
/usr/lib/perl5/site_perl/5.8.4
/usr/lib/perl5/site_perl/5.8.3
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.8
/usr/lib/perl5/vendor_perl/5.8.7
/usr/lib/perl5/vendor_perl/5.8.6
/usr/lib/perl5/vendor_perl/5.8.5
/usr/lib/perl5/vendor_perl/5.8.4
/usr/lib/perl5/vendor_perl/5.8.3
/usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/5.8.8
.
*** Packages of interest status:
Apache2 : -
Apache2::Request : 2.07
CGI : 3.15
ExtUtils::MakeMaker: 6.30
LWP : 5.805
mod_perl : -
mod_perl2 : 2.000002
3. This is the core dump trace: (if you get a core dump):
[CORE TRACE COMES HERE]
This report was generated by /usr/bin/mp2bug on Mon Apr 3 20:55:04 2006 GMT.
-------------8<---------- End Bug Report --------------8<----------