--- globalredirect.module	Tue Dec 20 21:19:56 2011
+++ globalredirect.module	Sat Jun 09 11:20:59 2012
@@ -66,12 +66,12 @@
     'prefix' => '',
     'external' => FALSE,
   );
+  $path = isset($_REQUEST['q']) ? $_REQUEST['q'] : '';
   if (function_exists('language_url_rewrite')) {
     // Note 1 : the language_url_rewrite() takes path (by reference) as the
     //          first argument but does not use it at all
     // Note 2 : We use $_REQUEST['q'] here as we want the path in an untouched
     //          form ($_GET['q] gets modified by core)
-    $path = isset($_REQUEST['q']) ? $_REQUEST['q'] : '';
     language_url_rewrite($path, $options);
   }
   $prefix = rtrim($options['prefix'], '/');
@@ -85,7 +85,7 @@
 
     // Redirect if the current request does not refer to the front page in the
     // configured fashion (with or without a prefix)
-    if (isset($_REQUEST['q']) && $_REQUEST['q'] != $prefix) {
+    if ($path != $prefix) {
       drupal_goto('', $query_string, NULL, 301);
     }
     elseif ($settings['nonclean_to_clean'] &&
@@ -197,9 +197,9 @@
 
   // Compare the request to the alias. This also works as a 'deslashing'
   // agent. If we have a language prefix then prefix the alias
-  if ($_REQUEST['q'] != $prefix . $alias) {
+  if ($path != $prefix . $alias) {
     // If it's not just a slash or user has deslash on, redirect
-    if (str_replace($prefix . $alias, '', $_REQUEST['q']) != '/' || $settings['deslash']) {
+    if (str_replace($prefix . $alias, '', $path) != '/' || $settings['deslash']) {
       globalredirect_goto($alias, $query_string);
     }
   }
@@ -219,13 +219,13 @@
   if ($settings['canonical']) {
     drupal_add_link(array(
       'rel' => 'canonical',
-      'href' => url(drupal_is_front_page() ? '<front>' : $_REQUEST['q'], array('absolute' => TRUE, 'query' => $query_string)),
+      'href' => url(drupal_is_front_page() ? '<front>' : $path, array('absolute' => TRUE, 'query' => $query_string)),
     ));
   }
 
   // Add the Content-Location header to the page
   if ($settings['content_location_header']) {
-    drupal_set_header('Content-Location: '. url(drupal_is_front_page() ? '<front>' : $_REQUEST['q'], array('absolute' => TRUE, 'query' => $query_string)));
+    drupal_set_header('Content-Location: '. url(drupal_is_front_page() ? '<front>' : $path, array('absolute' => TRUE, 'query' => $query_string)));
   }
 }
 
