Following instructions but can't get this to work

tizzo - June 30, 2008 - 23:19
Project:Protected Download (downld)
Version:5.x-1.0
Component:Code
Category:support request
Priority:normal
Assigned:TBarregren
Status:postponed (maintainer needs more info)
Description

I have followed the instructions laid out on the project page and in the README and have found that they work so long as the drupal site is in the webservers root but if it is in a subdirectory it stops working. I can't figure out the problem! It seems that the $_SERVER['REDIRECT_URL'] is empty if the drupal site isn't in the doc root. I don't know a lot about apache...what am I missing?

#1

tizzo - June 30, 2008 - 23:27
Status:active» needs review

Hunting around a bit more I've found that hacking the module and changing $_SERVER["REQUEST_URL"] to $_SERVER["REQUEST_URI"] makes it work in subdirs. Is there a reason not to do this?

I've attached a patch. Is this a security vulnerability? URI seems to work everywhere URL does and then some.

AttachmentSize
downld_subdirectories.patch 427 bytes

#2

tizzo - July 1, 2008 - 14:17

Also no matter what I do I can't seem to get this working on my local MAMP development enviornment. Can anyone confirm whether there is some reason this doesn't work? Perhaps I have something misconfiguration, though I can't figure out what.

#3

TBarregren - July 4, 2008 - 11:45
Assigned to:Anonymous» TBarregren
Status:needs review» postponed (maintainer needs more info)

According to Apache documentation there is no REDIRECT_URI but only REDIRECT_URL.

Could you please provide me with following information:

  • Version of your Apache server
  • Complete dump of $_SERVER, e.g. <?php print_r($_SERVER) ?>, when you hit a non-existing page.

#4

tizzo - July 8, 2008 - 18:36

Sorry for my late response, I was out of town for a long weekend and am just catching up on my correspondence.

My understanding is that URI isn't an apache variable but a PHP variable. It is documented here. On this server (hosted by mediatemple I believe) URI works and URL will return a page not found. I also needed URI to get this module to work on MAMP (and even then i couldn't get it configured properly). Running on the native apache server on OS X URL worked. URI was part of a print_r($_SERVER) on all of the listed systems.

Array
(
    [PATH] => /usr/local/bin:/usr/bin:/bin
    [REDIRECT_STATUS] => 403
    [UNIQUE_ID] => YZcxVwoCAR8AABTpgQoAAADn
    [REQUEST_METHOD] => GET
    [DATABASE_SERVER] => internal-db.s40235.gridserver.com
    [SITE_ROOT] => /home/40235
    [SITE_CGIROOT] => /home/40235/cgi-bin
    [SITE_HTMLROOT] => /home/40235/domains/dev.[mysite].com/html
    [HTTP_PHPCONF] => 1260749146
    [HTTP_HOST] => dev.[mysite].com
    [HTTP_USER_AGENT] => Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9) Gecko/2008061004 Firefox/3.0
    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    [HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.5
    [HTTP_ACCEPT_ENCODING] => gzip,deflate
    [HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7
    [HTTP_KEEP_ALIVE] => 300
    [HTTP_CONNECTION] => keep-alive
    [HTTP_REFERER] => http://dev.[mysite].com/content/etiam-sem-arcu-eleifend-sit-amet-gravida-eget-porta-wisi
    [HTTP_COOKIE] => SESS14c718601dfc8d8857789ffdbef35f49=bb4fd1188fe9990862507915f42b4102
    [SERVER_SIGNATURE] => <address>Apache/2.0.54 Server at dev.[mysite].com Port 80</address>

    [SERVER_SOFTWARE] => Apache/2.0.54
    [SERVER_NAME] => dev.[mysite].com
    [SERVER_ADDR] => [xx.xx.xx]
    [SERVER_PORT] => 80
    [REMOTE_ADDR] => xx.xx.xx.xx
    [DOCUMENT_ROOT] => /home/40235/domains/dev.[mysite].com/html
    [SERVER_ADMIN] => webmaster@dev.[mysite].com
    [SCRIPT_FILENAME] => /home/40235/domains/dev.[mysite].com/html/index.php
    [REMOTE_PORT] => 33434
    [REDIRECT_QUERY_STRING] => q=home/40235/domains/dev.[mysite].com/html/index.php
    [REDIRECT_URL] => /index.php
    [GATEWAY_INTERFACE] => CGI/1.1
    [SERVER_PROTOCOL] => HTTP/1.1
    [QUERY_STRING] => q=home/40235/domains/dev.[mysite].com/html/index.php
    [REQUEST_URI] => /files/story/poster.png
    [SCRIPT_NAME] => /index.php
    [PATH_INFO] =>
    [PATH_TRANSLATED] =>
    [ORIG_PATH_TRANSLATED] => /home/40235/domains/dev.[mysite].com/html/index.php
    [ORIG_PATH_INFO] => /index.php
    [ORIG_SCRIPT_NAME] => /gs-bin/php4
    [ORIG_SCRIPT_FILENAME] => /etc/apache2/gs-bin/php4
    [PHP_SELF] => /index.php
    [argv] => Array
        (
            [0] => q=home/40235/domains/dev.[mysite].com/html/index.php
        )

    [argc] => 1
)

#5

bjorpe - February 24, 2009 - 22:18

I get the same kind of problem on an Apache 1.3.37 server.

It seems that REDIRECT_URL is the target rather than the source of the redirect. To get $file right I have to use REQUEST_URI (and remove first part of it).

I just got this working, don't know if there is a good general solution.

 
 

Drupal is a registered trademark of Dries Buytaert.