Index: src/apache-2/mod_rivet.c
===================================================================
--- src/apache-2/mod_rivet.c	(revision 584720)
+++ src/apache-2/mod_rivet.c	(working copy)
@@ -91,40 +91,24 @@
 }
 #endif /* 0 */
 
-/*
- * Rivet_IsRivetFile(char*)
- *
- * small helper function to get the file type. Returns 1 if
- * the file ends with .rvt, 0 otherwise.
- */
 static int
-Rivet_IsRivetFile (char *filepath)
+Rivet_CheckType (request_rec *req)
 {
-    char *fileCopy = (char*) malloc((strlen(filepath)+1) * sizeof(char));
-    char *cPtr;
+/* 
+    fprintf(stderr, "content_type: %s\n", req->content_type);
+    fflush(stderr);
+*/
+	if ( req->content_type != NULL ) {
+		if( STREQU( req->content_type, "application/x-httpd-rivet")) {
+			return RIVET_FILE;
+		}
 
-    strcpy (fileCopy, filepath);
-    cPtr = fileCopy + (strlen(fileCopy) - 3);
-
-    if (*(cPtr-1) != '.') {
-        char *ePtr = fileCopy + (strlen(fileCopy) - 1);
-        while (*ePtr-- != '?')
-            ;
-        ePtr++;
-        *ePtr = '\0';
-        cPtr = ePtr - 3;
+		 if( STREQU( req->content_type, "application/x-rivet-tcl")) {
+			return TCL_FILE;
+		}
     }
-    
-    if (strcmp (cPtr, "rvt") == 0) {
-        return RIVET_FILE;
-    }
-    else if (strcmp (cPtr, "tcl") == 0) {
-        return TCL_FILE;
-    }
- 
-    return 0;
+	return 0; 
 }
-
 /*
  * Rivet_ParseFileArgString (char *szDocRoot, char *szArgs, char **file)
  *
@@ -133,6 +117,7 @@
  * arguments and returned. The file name is appended to the szDocRoot
  * argument and stored in the *file pointer.
  */
+#if 0
 static int
 Rivet_ParseFileArgString (const char *szDocRoot, const char *szArgs, char **file,apr_pool_t *p, 
         Tcl_HashTable *argTbl)
@@ -199,8 +184,8 @@
     
     return RIVET_OK;
 }
+#endif
 
-
 /*
  * Setup an array in each interpreter to tell us things about Apache.
  * This saves us from having to do any real call to load an entire
@@ -471,9 +456,7 @@
             }
         }
 
-        //if( 1//STREQU( req->req->content_type, "application/x-httpd-rivet")
-        //        || !toplevel )
-        if (Rivet_IsRivetFile(filename) == RIVET_FILE)
+        if (Rivet_CheckType(req->req) == RIVET_FILE)
         {
             /* toplevel == 0 means we are being called from the parse
              * command, which only works on Rivet .rvt files. */
@@ -1440,24 +1423,24 @@
     //apr_pool_cleanup_register (pChild, s, Rivet_ChildExit, Rivet_ChildExit);
 }
 
+/* dead wood */
+/* 
 static int
 Rivet_TranslateUri (request_rec *r)
 {
     char *filename;
-    /*
     Tcl_HashTable argTbl;
     Tcl_HashSearch searchPtr;
     Tcl_HashEntry *entryPtr;
-    */
     int res = RIVET_OK;
   
-    fprintf(stderr, "file: %s\n", r->filename);
-    fflush(stderr);
     if (r->main)
         filename = r->main->filename;
     else
         filename = r->filename;
     
+    fprintf (filename, "%s", filename);
+    fflush (stderr);
     if (r->main) {
         res = Rivet_ParseFileArgString (ap_document_root(r), r->unparsed_uri, 
                 &r->main->filename, r->pool, NULL);
@@ -1471,11 +1454,7 @@
 
     if (res != RIVET_OK)
         return HTTP_BAD_REQUEST;
-
-    if (!Rivet_IsRivetFile (filename))
-        return DECLINED;
-
-    /*
+	Tcl_InitHashTable(&argTbl,TCL_STRING_KEYS);
     for (entryPtr = Tcl_FirstHashEntry(&argTbl, &searchPtr);
             entryPtr != NULL;
             entryPtr = Tcl_NextHashEntry (&searchPtr)) {
@@ -1485,13 +1464,14 @@
         fprintf (stderr, "arg=%s, val=%s\n", arg, val);
         fflush (stderr);
     }
-    */
 
+*/
     /* 
      * seems that a subrequest is created for / processing. If this is a /
      * request, set the filename into r->main (which is the request that
      * is propagated through)
      */
+/*
     if (r->main)
         r->main->filename = filename;
     else
@@ -1499,6 +1479,7 @@
     
     return DECLINED;
 }
+*/
 
 /* Set things up to execute a file, then execute */
 static int
@@ -1517,7 +1498,7 @@
     rivet_server_conf *rsc = NULL;
     rivet_server_conf *rdc;
 
-    if (!Rivet_IsRivetFile(r->filename))
+    if (!Rivet_CheckType(r))
         return DECLINED;
 
     Tcl_MutexLock(&sendMutex);
@@ -1544,8 +1525,7 @@
         goto sendcleanup;
     }
 
-    //if (r->finfo.st_mode == 0)
-    if (!r->finfo.valid)
+    if (r->finfo.protection == 0)
     {
         ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, APR_EGENERAL, r->server,
                 "File does not exist: %s",
@@ -1667,8 +1647,7 @@
 
     ap_hook_post_config (Rivet_InitHandler, NULL, NULL, APR_HOOK_LAST);
     ap_hook_handler (Rivet_SendContent, NULL, NULL, APR_HOOK_LAST);
-    ap_hook_translate_name (Rivet_TranslateUri, aszPreTranslate, NULL,
-            APR_HOOK_MIDDLE);
+/*    ap_hook_translate_name (Rivet_TranslateUri, aszPreTranslate, NULL, APR_HOOK_MIDDLE); */
     ap_hook_child_init (Rivet_ChildInit, NULL, NULL, APR_HOOK_LAST);
 }
 
