[m-rev.] for review: make mdprof_cgi respect CGI environment variables

Peter Wang wangp at students.csse.unimelb.edu.au
Mon Apr 2 12:44:14 AEST 2007


On 2007-04-02, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
> >+
> >+script_name(ScriptName, !IO) :-
> >+    io.get_environment_var("SCRIPT_NAME", MaybeScriptName, !IO),
> >+    (
> >+        MaybeScriptName = yes(ScriptName)
> >+    ;
> >+        MaybeScriptName = no,
> >+        % XXX not sure how to handle this, but should not occur in 
> >practice
> >+        ScriptName = "/"
> 
> Then perhaps calling error/1 would be a better thing to do.

Actually, script_name is called from other tools like mdprof_feedback.
I've changed it to this:

diff -u conf.m conf.m
--- conf.m      2 Apr 2007 00:50:20 -0000
+++ conf.m      2 Apr 2007 02:31:09 -0000
@@ -122,8 +122,9 @@
         MaybeScriptName = yes(ScriptName)
     ;
         MaybeScriptName = no,
-        % XXX not sure how to handle this, but should not occur in practice
-        ScriptName = "/"
+        % Should not happen if this predicate is called as a CGI program,
+        % but this predicate is also called by other tools.
+        ScriptName = "/cgi-bin/mdprof_cgi"
     ).
 
 :- pred mkfifo_cmd(string::out) is det.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list