httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 46376] New: %{REQUEST_FILENAME} does not hold full local filesystem path to the file or script matching the request
Date Wed, 10 Dec 2008 15:54:50 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=46376

           Summary: %{REQUEST_FILENAME} does not hold full local filesystem
                    path to the file or script matching the request
           Product: Apache httpd-2
           Version: 2.2-HEAD
          Platform: PC
               URL: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#re
                    writecond
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Documentation
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: romain.gallet@gmail.com


In the section RewriteCond Directive, it says:

REQUEST_FILENAME
    The full local filesystem path to the file or script matching the request.

However, this variable seems to hold only the part on the URL after the
hostname. Example, in

- http://localhost/images/hotelphotos1/14032.jpg

According to the documentation, with a DocumentRoot of "/var/www/html", you
would expect %{REQUEST_FILENAME} to be

- /var/www/html/images/hotelphotos1/14032.jpg

But it really is just:

- /images/hotelphotos1/14032.jpg

How to prove/reproduce:
- Apache 2.2.10 (ArchLinux official package)
- In the vhost config, I have one and only one rule:
  RewriteRule (.*) http://www.google.com/?test=%{REQUEST_FILENAME} [L]

Using the URL http://localhost/images/hotelphotos1/14032.jpg, I get

http://www.google.com/?test=/images/hotelphotos1/14032.jpg

which shows that %{REQUEST_FILENAME} is NOT the full local filesystem path to
14032.jpg.

This is an issue because RewriteCond testing for the presence of a file, ie
RewriteCond %{REQUEST_FILENAME} -f will always return False.

It can be circumvented using

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -f

I could reproduce this bug/behavior on CentOS5 and the latest Apache2 rpm.

To be, this behavoir makes sense. It'd rather need a change in the
documentation for that feature.

Regards.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message