Project

General

Profile

Actions

Bug #102

closed

lighttpd wrongly overwrites status code in drupal 4.6

Added by Anonymous about 19 years ago. Updated over 17 years ago.

Status:
Fixed
Priority:
Normal
Category:
core
Target version:
-
ASK QUESTIONS IN Forums:

Description

I am sorry if this description is a little difficult, but this error only occurs when you patch both drupal 4.6 and lighttpd 1.3.13

This is probably the case with PHP as a whole (?). When using clean urls with server.error-handler-404 = "/index.php" lighttpd overwrites the status code that drupal sends. Before clean urls work in drupal include/common.inc has to be patched like this. Directly after


// Initialize $_GET['q'] prior to loading modules and invoking hook_init().

add this:


if (empty($_GET['q'])) {
  $query = strpos(request_uri(), '?');
  $request= $query ? substr(request_uri(), 0, $query) : request_uri();
  $path = substr($request, strlen(trim(dirname($_SERVER['SCRIPT_NAME']), '/'))+1);
  if ($path != '/' && $path != '/index.php') {
     $_GET['q'] = $path;
  }
}

Then activate clean urls in http://127.0.0.1/?q=admin/settings

When clean urls work, use wget:

{{{wget -S http://127.0.0.1/admin/settings}}}

You will get a 404. Now you have to patch lighttpd. In connections.c remove this:


if (con->http_status == 0) {
  con->http_status = con->error_handler_saved_status;
}

Now lighttpd will send a 200 on wget -S http://127.0.0.1/admin/settings. Since wget is not authenticated in drupal it drupal emits a 403 on calling /admin/settings. This 403 is overwritten by lighttpd.

-- se

Actions #1

Updated by Anonymous over 18 years ago

Even easier is this url rewrite that enables clean urls for drupal - basically anything with a . is a proper url and anything without it is passed to index.php
The sysem/test line is needed to enable clean urls within drupal

url.rewrite-final = (
"^/system/test/(.*)$" => "/index.php?q=system/test/$1",
"^/(^.*)\?(.*)$" => "/index.php?q=$1&$2",
"^/(^.*)$" => "/index.php?q=$1"
)

-- UberLord

Actions #2

Updated by conny about 18 years ago

  • Status changed from New to Fixed
  • Resolution set to fixed

The status code from the 404 handler is properly returned, nowadays.

Actions

Also available in: Atom