=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Doc/cgi.sm1,v retrieving revision 1.14 retrieving revision 1.16 diff -u -p -r1.14 -r1.16 --- OpenXM/src/kan96xx/Doc/cgi.sm1 2013/09/22 05:17:17 1.14 +++ OpenXM/src/kan96xx/Doc/cgi.sm1 2013/09/25 07:30:52 1.16 @@ -1,4 +1,4 @@ -% $OpenXM: OpenXM/src/kan96xx/Doc/cgi.sm1,v 1.13 2013/09/22 01:07:38 takayama Exp $ +% $OpenXM: OpenXM/src/kan96xx/Doc/cgi.sm1,v 1.15 2013/09/22 08:07:51 takayama Exp $ % OpenXM/src/polymake/cgi/cgi-polymake.sh % is a shell script to call sm1/polymake as a CGI script. % Override as /doPolymake {doPolymake.OoHG} def if you need. @@ -255,26 +255,15 @@ def (/tmp/sm1-q-cgi.txt) (w) file /fd set fd body writestring fd closefile - [(curl) (--form) [key (=@/tmp/sm1-q-cgi.txt)] cat ff1] /ff set - ff message - ff - addStdoutStderr oxshell - @@@stdout /pp set - pp message - @@2stderr message - (-----) message - % For the case of error. - [(regexec) (200 OK) [pp]] extension length 0 eq { - (sss2=) message - sss2 message - (pp=) message - pp message - (cgi.sm1: there seems to be an error in the HTTP connection.) - } { } ifelse +% [(curl) (--form) [key (=@/tmp/sm1-q-cgi.txt)] cat ff1] /ff set +% ff addStdoutStderr oxshell @@@stdout /pp set + [(curl --form ) [key (=@/tmp/sm1-q-cgi.txt )] cat ff1 (>/tmp/sm1-q-cgi-out.txt)] cat /ff set + ff system + [nl (/tmp/sm1-q-cgi-out.txt) pushfile] cat /pp set cgi.verbose { pp message } { } ifelse [(cgiHttpToKeyValuePair) pp] extension /pp2 set - + pp2 message % step 3. Analyze the response. [pp2 (Content-Body) getNode pp2 (oxshell-stdout) getNode @@ -352,6 +341,9 @@ def (If not, it calls http://polymake.math.kobe-u.ac.jp/cgi-bin/cgi-polymake.sh) (to make a computation in polymake.) (See doPolymake for the syntax. doPolymake.OoHG may overrides doPolymake.) + (If you use curl to call the server execute) + ( usePolymake.OoHG.curl) + (after loading cgi.sm1) ]] putUsages /doPolymake.OoHG { /arg1 set @@ -378,7 +370,7 @@ def % cgi-polymake (Trying web service.) message pAction pNative cgiQueryPolymake /doPolymake.OoHG.result set - + doPolymake.OoHG.result /@@@doPolymake.vars set [(regexec) (Not Found) [doPolymake.OoHG.result 0 get ]] extension length 0 eq not { doPolymake.OoHG.result message @@ -428,6 +420,39 @@ def (polymake2tfb is not installed in this system.) error } { } ifelse } def + + +/usePolymake.local { + /doPolymake { doPolymake.local } def + /polymake.start { polymake.start.local } def +} def + +/usePolymake.OoHG.native { + /doPolymake { doPolymake.OoHG } def + /polymake.start { polymake.start.OoHG } def + /cgiQueryPolymake { cgiQueryPolymake.native } def +} def + +/usePolymake.OoHG.curl { + /doPolymake { doPolymake.OoHG } def + /polymake.start { polymake.start.OoHG } def + /cgiQueryPolymake { cgiQueryPolymake.curl } def +} def + +[(usePolymake.OoHG.native) +[(doPolymake = doPolymake.OoHG with cgiQueryPolymake.native) + (cf. doPolymake.OoHG) +]] putUsages + +[(usePolymake.OoHG.curl) +[(doPolymake = doPolymake.OoHG with cgiQueryPolymake.curl) + (It should be used when cgiQueryPolymake.native does not work) + (over, e.g., a reverse proxy.) + (The command curl is required. cf. cgi.verbose, doPolymake.OoHG) +]] putUsages + + + \ No newline at end of file