=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Doc/httpd-asir.sm1,v retrieving revision 1.6 retrieving revision 1.10 diff -u -p -r1.6 -r1.10 --- OpenXM/src/kan96xx/Doc/httpd-asir.sm1 2001/04/22 00:34:01 1.6 +++ OpenXM/src/kan96xx/Doc/httpd-asir.sm1 2001/04/23 13:34:00 1.10 @@ -1,7 +1,8 @@ -%% $OpenXM: OpenXM/src/kan96xx/Doc/httpd-asir.sm1,v 1.5 2001/04/21 13:54:29 takayama Exp $ +%% $OpenXM: OpenXM/src/kan96xx/Doc/httpd-asir.sm1,v 1.9 2001/04/22 04:55:07 takayama Exp $ %% http server by sm1 /httpd.port 1200 def + /httpd.initialization %% Put initialization codes here. [ @@ -9,6 +10,7 @@ " Risa/Asir oxasir version "+rtostr(version());) ] cat def + [(parse) (oxasir.sm1) pushfile] extension (oxasir.started) boundp { } { @@ -19,10 +21,20 @@ def } ifelse /asirweb { + [/rrr ] pushVariables + [ + %% This procedure to generate port number might fail. + [(oxGenPass)] extension . (integer) dc /rrr set + rrr << rrr 20000 idiv 20000 mul >> sub /rrr set + /httpd.port 1200 rrr add def + httpd.port message + [(sleep 3; netscape -geometry 800x500 http://localhost:) httpd.port toString ( &)] cat system httpd ; + ] pop + popVariables } def /httpd_startserver { @@ -53,7 +65,11 @@ def }{ 10 (string) dc /mmm set } ifelse - [(sm1.socket) (write) [httpd.server.fd 0 get mmm]] extension message + [(sm1.socket) (select) [httpd.server.fd 0 get 0]] extension { + (Warning: your peer closed the connection. Do not send the data.) message + } { + [(sm1.socket) (write) [httpd.server.fd 0 get mmm]] extension message + } ifelse ] pop popVariables } def @@ -94,9 +110,13 @@ def /httpd.com httpd.initialization def } { } ifelse httpd.com metaCommand { - oxasir.ccc - [(if (1) {) httpd.com (};)] cat - oxexecutestring ; + httpd.textarea.valid { + oxasir.ccc + [(if (1) {) httpd.com (; };)] cat + oxexecutestring ; + }{ + send-page-warning exit + } ifelse [(oxReq) oxasir.ccc SM_dupErrors ] extension pop [(oxReq) oxasir.ccc SM_popCMO ] extension pop @@ -140,6 +160,7 @@ def (/**** ) httpd.serial toString ( ****/) 10 (string) dc httpd.com + (;) %% add extra ; ] cat append def @@ -153,11 +174,11 @@ def (
) httpd.com () (
) httpd.result () + httpd.result preformatHTML ] cat send-page-3 exit } { exit } ifelse %% metaCommand @@ -214,7 +235,8 @@ def result sendln () sendln send-menu-1 0 sendln @@ -260,19 +282,16 @@ def [ (HTTP/0.9 200 OK) sendln (Connection: close) sendln - (Content-Type: text/html) sendln + (Content-Type: text/plain) sendln 0 sendln - ( ) sendln - (/* Saved the following to sm1out.txt */
) sendln 0 1 httpd.history length 1 sub { /i set httpd.history i get sendln } for - () sendln - ( ) sendln + ( end$) sendln 0 sendln [(flush)] extension [(PrintDollar) 1] system_variable @@ -282,6 +301,15 @@ def popVariables } def +/send-page-warning { + (HTTP/0.9 200 OK) sendln + (Connection: close) sendln + (Content-Type: text/html) sendln + 0 sendln + (You cannot execute oxasir without a session key!
) sss ()] cat /arg1 set + ] pop + popVariables + arg1 +} def + /metaCommand { /arg1 set [/in-metaCommand /msg /result] pushVariables @@ -398,6 +505,7 @@ def /msg arg1 def /result 1 def msg (httpdAsirMeta quit) eq { + oxasir.ccc oxshutdown send-page-bye quit /result 0 def