however you are setting a drupal_set_header("HTTP/1.1 301 Moved Permanently"); a 302 is executed.
it looks like this is caused by drupal_goto and the location inside this function, but i currently don't know why...
i have tested this with the path.inc v1.4.2.5 (CVS) on Drupal 4.7.4 with your v1.1 and HEAD version with no difference.
This is the Log:
GET /drupal/index.php?q=node/21 HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: de,en;q=0.8,en-us;q=0.6,de-de;q=0.4,es;q=0.2
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: PHPSESSID=8tjb18qeg9fvbd267c1ojahha3
HTTP/1.x 302 Object Moved</strong
Server: Microsoft-IIS/5.1
Date: Tue, 26 Dec 2006 13:15:46 GMT
Connection: close
Content-Type: text/html
X-Powered-By: PHP/5.1.0
Set-Cookie: PHPSESSID=8tjb18qeg9fvbd267c1ojahha3; expires=Thu, 18 Jan 2007 16:49:05 GMT; path=/
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified: Tue, 26 Dec 2006 13:15:45 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: http://localhost/drupal/index.php?q=example
Comments
Comment #1
hass commentedlooks like a known bug... http://drupal.org/node/75803 and no backport to 4.7.x
looks like you need to rebuild the drupal_goto function for your own...
Comment #2
hass commentedChange all your
drupal_gotointoglobalredirect_goto. i changed this bug to 4.7, while you are able to whipe out this workaround for Drupal 5 and only change the 4 param for drupal_goto.Comment #3
Anonymous (not verified) commentedCan you create a patch and attach it? There is talk of a Drupal 4.7.5 release and this could go to a 4.7.5 release for globalredirect.
Comment #4
hass commentedThis looks more a PHP Bug. I verified the Bug with PHP 5.1 and 5.2 with CGI on IIS. I read about such bugs in PHP Bug database, but all cases are closed or marked as bogus.
On Apache the module is working correctly with the updated path.inc. However i found some comments on PHP.net explaining it is not correct to send two headers. First the Status 301 and then the location should be wrong... the following is the correct redirection - i don't know.
header('Location: '. $url, TRUE, $http_response_code);Comment #5
nicholasthompsonSo is it a bug with PHP5/IIS or is this a problem I need to address in the module?
Comment #6
hass commentedtoday it looks like a PHP bug... however the bug has been closed on 1.1.06 and i was told it was fixed in CVS, but until now it isn't... however it looks not like a bug in your module.
Asside - as a reminder for Drupal 5 you must remove the header 301 lines and change the goto lines into...
drupal_goto($url, true, 301);
Comment #7
nicholasthompsonWill change this - thanks for the heads up!
Comment #8
nicholasthompsonI updated the code for Drupal 5 and I've checked that 301/302 bug and I don't seem to be getting any problems...
I'm gonna mark this as fixed as I've address the only problem I'm in control of - so it seems :-)
Comment #9
hass commentedyes, the not correctly set HTTP status code is a IIS-with-PHP bug... for sure, not yours :-).
Comment #10
nicholasthompsonWow - its so unlike an MS product to have a bug in it ;-)
I've always wondered why people chose to use Windows to run a WebServer...
Comment #11
hass commentedBut it's an PHP Bug on the end of the day... not MS fault :-).
Comment #12
(not verified) commented