--- coral_defender.module	2007-08-08 09:54:20.000000000 -0400
+++ coral_defender.module	2008-02-07 00:46:03.000000000 -0500
@@ -19,7 +19,7 @@
  * Implementation of hook_init
  * 
  * Early checking of the Referer requested.
- * If a match is found, user is redirected using drupal_goto()
+ * If a match is found, user is redirected using coral_defender_goto()
  *
  */
 function coral_defender_init() {
@@ -33,15 +33,26 @@
 	 	$r = db_fetch_object(db_query('SELECT rid FROM {coral_defender} WHERE host = "%s"', $referer['host']));
 		if ($r) {
 	               if(variable_get('clean_url', 0)) {
-	                       drupal_goto('http://' . $_SERVER['HTTP_HOST'] . '.nyud.net:8080' . ($_SERVER['REQUEST_URI'] ? $_SERVER['REQUEST_URI'] : NULL), null, null, 307);
+	                       coral_defender_goto($dest);
 	               } else {
-	                       drupal_goto('http://' . $_SERVER['HTTP_HOST'] . '.nyud.net:8080', ($_SERVER['QUERY_STRING'] ? $_SERVER['QUERY_STRING'] : NULL) , null, 307);
+                           // this obviously needs work
+	                       coral_defender_goto($dest);
 	               }
 		}
 	}
 }
 
 /**
+ * Use this instead of drupal_goto() which isn't available during bootstrap
+ */
+function coral_defender_goto($dest) {
+  $dest = 'http://' . $_SERVER['HTTP_HOST'] . '.nyud.net:8080' . ($_SERVER['REQUEST_URI']);
+  // is this secure? we might need to check for extra lines
+  header('Location: '. $dest, 307);
+  exit();
+}
+
+/**
  * Implementation of hook_menu
  *
  */
