Environment Variable to determine the URL Path

[prev] [thread] [next] [lurker] [Date index for 2003/12/3]

From: Shlomi Fish
Subject: Environment Variable to determine the URL Path
Date: 20:57 on 03 Dec 2003
I've seen that in YAPC::Organizer we are using $ENV{REQUEST_URI}:

<<<
sub get_page {

   # REQUEST_URI looks like this:  /content.html
   my $page = $ENV{REQUEST_URI} || '';
   $page =~ s@.*/@@;
   $page =~ s/\.html(\?.*)?$//;
   $page ||= 'index';

   my $filename = "$templates_dir/$page.tmpl";

   return ($page, $filename);
}
>>>

Unless I'm wrong, this solution is suboptimal. REQUEST_URI contains the entire 
path of the CGI script like  /cgi-bin/test.cgi/hello/there. OTOH, the 
PATH_INFO env var contains just the trailing components: "/hello/there". So I 
think we should use it instead. This would also enable us to add a nested URL 
tree to the path. (/my/ that contains /my/presentations/, etc.).

And why is: http://www.perl.org.il/YAPC/2004/hello/ (or any path containing a 
/) redirected to the root of the site?

Regards,

	Shlomi Fish

-- 

---------------------------------------------------------------------
Shlomi Fish      shlomif@xxxx.xxx.xx
Homepage: http://t2.technion.ac.il/~shlomif/

I don't believe in fairies. Oops! A fairy died.
I don't believe in fairies. Oops! Another fairy died.

Generated at 11:20 on 04 Dec 2003 by mariachi 0.51