You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2008/12/10 16:54:50 UTC

DO NOT REPLY [Bug 46376] New: %{REQUEST_FILENAME} does not hold full local filesystem path to the file or script matching the request

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


DO NOT REPLY [Bug 46376] %{REQUEST_FILENAME} does not hold full local filesystem path to the file or script matching the request

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46376


Bob Ionescu <bo...@googlemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE




--- Comment #1 from Bob Ionescu <bo...@googlemail.com>  2008-12-11 05:14:05 PST ---


*** This bug has been marked as a duplicate of bug 16402 ***


-- 
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