request_uri() checks for a valid REQUEST_URI header (which Apache apparently provides) and returns it if found, otherwise it builds its own. Thttpd provides this header, but differently from Apache. It doesn't append the QUERY_STRING. Under Drupal, this means that all request_uris look like 'index.php' without the module. Since this is used for the form actions, all forms break under Thttpd (they just redirect back to index without doing anything). To work around this locally, I've hacked common.inc to always build its own request_uri.

CommentFileSizeAuthor
#3 request_uri.patch466 bytesAnonymous (not verified)

Comments

moshe weitzman’s picture

Since this is a very unpoplar web server, you are going to have to provide a patch along with this report if you want it fixed.

Anonymous’s picture

Title: request_uri() broken under thttpd » request_uri() broken under thttpd [IIS]

Update to request_uri() method definition from bootstrap.inc for HTTP servers (such as IIS or the above mentioned thttpd) that do not provide the REQUEST_URI header and do provide the information through QUERY_STRING.

function request_uri() {
/*
** Since request_uri() is only available on Apache, we generate
** equivalent using other environment vars.
*/

if (isset($_SERVER["REQUEST_URI"])) {
$uri = $_SERVER["REQUEST_URI"];
}
else if (isset($_SERVER["QUERY_STRING"])) {
$uri = $_SERVER["QUERY_STRING"];
}
else {
$uri = $_SERVER["PHP_SELF"] ."?". $_SERVER["argv"][0];
}

return check_url($uri);
}

Anonymous’s picture

StatusFileSize
new466 bytes

request_uri() is also broken under Xitami: neither _SERVER["REQUEST_URI"] nor _SERVER["argv"] are valued. However, the standard CGI environment variables _SERVER["SCRIPT_NAME"] and _SERVER["QUERY_STRING"] are valued. (These are probably the lowest-common-denominator variables for obtaining the URI.)

The attached patch adds support for servers that provide standard CGI environment variables. Note that the test must be for the presence of SCRIPT_NAME since QUERY_STRING is not always valued.

Based on the original poster's remarks, I doubt that this patch will work for thttpd, since its REQUEST_URI seems to be broken. This could be remedied by putting the new test first.

dries’s picture

$_SERVER["SCRIPT_NAME"] . "?" . $_SERVER["QUERY_STRING"]; ... works for Apache too but it does not respect the clean URL setting so you break out the clean URLs occasionally (eg. after submitting a form). In other words: it works but is not optimal.

I wonder if this patch interfers with IIS ... ?

dries’s picture

Waiting for follow up. Making this 'active' in the mean time because the patch's status is unsure.

dries’s picture

robin monks’s picture

I can run Xitami with Drupal fine, I take it this has been cleared up somewhere along the patch from 4.4.1 to 4.6.1...

Robin

Anonymous’s picture

dfaulkner’s picture

Title: request_uri() broken under thttpd [IIS] » New issue created, non-server specific
Version: » 4.7.3

I have experienced the same problem using SunOne (AKA iPlanet) Enterprise 6.0. I solved the problem in what I believe to be a server-independent manner, and so have created a differently titled issue for the patch. (Also, this patch was closed, and I didn't want to re-open it)

View my notes and patch at http://drupal.org/node/87310

dfaulkner’s picture

Title: New issue created, non-server specific » request_uri() broken under thttpd [IIS]