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,22 @@
 }
 #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;
-
-    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 (strcmp (cPtr, "rvt") == 0) {
+/* 
+    fprintf(stderr, "content_type: %s\n", req->content_type);
+    fflush(stderr);
+*/
+     if( STREQU( req->content_type, "application/x-httpd-rivet")) {
         return RIVET_FILE;
     }
-    else if (strcmp (cPtr, "tcl") == 0) {
+
+     if( STREQU( req->content_type, "application/x-rivet-tcl")) {
         return TCL_FILE;
     }
- 
-    return 0;
+	return 0; 
 }
-
 /*
  * Rivet_ParseFileArgString (char *szDocRoot, char *szArgs, char **file)
  *
@@ -471,9 +453,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. */
@@ -1451,8 +1431,6 @@
     */
     int res = RIVET_OK;
   
-    fprintf(stderr, "file: %s\n", r->filename);
-    fflush(stderr);
     if (r->main)
         filename = r->main->filename;
     else
@@ -1472,9 +1450,6 @@
     if (res != RIVET_OK)
         return HTTP_BAD_REQUEST;
 
-    if (!Rivet_IsRivetFile (filename))
-        return DECLINED;
-
     /*
     for (entryPtr = Tcl_FirstHashEntry(&argTbl, &searchPtr);
             entryPtr != NULL;
@@ -1517,7 +1492,7 @@
     rivet_server_conf *rsc = NULL;
     rivet_server_conf *rdc;
 
-    if (!Rivet_IsRivetFile(r->filename))
+    if (!Rivet_CheckType(r))
         return DECLINED;
 
     Tcl_MutexLock(&sendMutex);
