diff -Naur bitcache.original/bitcache.server.inc bitcache/bitcache.server.inc --- bitcache.original/bitcache.server.inc 2008-05-09 13:15:59.000000000 +0200 +++ bitcache/bitcache.server.inc 2008-07-16 13:18:34.000000000 +0200 @@ -23,35 +23,23 @@ } $method = $_SERVER['REQUEST_METHOD']; - $request = $_SERVER['REDIRECT_URL']; // FIXME: handle lack of mod_rewrite? + $request = $_GET['q']; + + if ($request == BITCACHE_ALIAS) + $request = $request . '/'; // Create the repository directory if it doesn't exist yet. file_check_directory($path = BITCACHE_ROOT, TRUE); // Attempt to dispatch the request to the Bitcache server implementation. - $base = url(BITCACHE_ALIAS, array('alias' => TRUE)); - if (strpos($request, $base) === 0) { - $request = substr($request, strlen($base)); - - // Ensure that the bitstream index is accessed with a trailing slash. - if (!$request) { - die(drupal_goto(BITCACHE_ALIAS . '/', NULL, NULL, 301)); - } + if (strpos($request, BITCACHE_ALIAS) === 0) { + $request = substr($request, strlen(BITCACHE_ALIAS)); $server = new Bitcache_DrupalServer(BITCACHE_ROOT, array('tmpdir' => file_directory_temp())); $server->$method($request); die(); } - // A path alias has been defined for the Bitcache server root URL, but the - // incoming request was still using an internal path; redirect the client - // to the correct address. - $base = url(BITCACHE_BASE, array('alias' => TRUE)); - if (strpos($request, $base) === 0) { - $request = substr($request, strlen($base)); - die(drupal_goto(BITCACHE_ALIAS . $request ? $request : '/', NULL, NULL, 301)); - } - die(drupal_not_found()); // should never get here }