=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Doc/httpd-rpc.sm1,v retrieving revision 1.13 retrieving revision 1.17 diff -u -p -r1.13 -r1.17 --- OpenXM/src/kan96xx/Doc/httpd-rpc.sm1 2002/12/04 00:02:10 1.13 +++ OpenXM/src/kan96xx/Doc/httpd-rpc.sm1 2013/03/07 02:10:32 1.17 @@ -1,7 +1,8 @@ -%% $OpenXM: OpenXM/src/kan96xx/Doc/httpd-rpc.sm1,v 1.12 2002/11/10 07:00:03 takayama Exp $ +%% $OpenXM: OpenXM/src/kan96xx/Doc/httpd-rpc.sm1,v 1.16 2012/12/23 02:33:16 takayama Exp $ %% http server by sm1. Used for RPC. Generic example. [(parse) (httpd.sm1) pushfile] extension pop +/httpd.textmode 1 def %% It does not work on some browsers. /httpd_action { httpd_action_allow_file_transfer @@ -43,10 +44,10 @@ def def /httpd.asirman - ("http://www.math.sci.kobe-u.ac.jp/OpenXM/1.2.1/doc/asir2000/html-eg/man_toc.html") + ("http://www.math.sci.kobe-u.ac.jp/OpenXM/1.2.1/doc/asir2000/html-en/man_toc.html") def /httpd.asirman.ja - ("http://www.math.sci.kobe-u.ac.jp/OpenXM/1.2.1/doc/asir2000/html-jp/man_toc.html") + ("http://www.math.sci.kobe-u.ac.jp/OpenXM/1.2.1/doc/asir2000/html-ja/man_toc.html") def [(parse) (oxasir.sm1) pushfile] extension @@ -81,7 +82,10 @@ oxNoX 3] extension }{ %% On unix. - [(sleep 3 ; netscape http://) + [(ostype)] extension 1 get (mac) eq { + /webrpc.browser (open) def + } { /webrpc.browser (firefox) def } ifelse + [(sleep 3 ; ) webrpc.browser ( http://) [(sm1.socket) (gethostname) []] extension (:) httpd.port toString ( & ) ] cat system @@ -401,19 +405,24 @@ oxNoX /send-page-result { /arg1 set - [/in-send-page-result /result] pushVariables + [/in-send-page-result /result /hlen /msg1 /msg2] pushVariables [ /result arg1 def + /msg1 (
) def + /msg2 () def + httpd.textmode { 0 /hlen set } + { msg1 length msg2 length add 3 add /hlen set } ifelse (HTTP/0.9 200 OK) sendln (Connection: close) sendln - [(Content-length: ) result length toString ] cat sendln - (Content-Type: text/html) sendln - %(Content-Type: text/plain) sendln % It does not work on some browsers. + [(Content-length: ) result length hlen add toString ] cat sendln + httpd.textmode + { (Content-Type: text/plain) sendln } % It does not work on some browsers. + { (Content-Type: text/html) sendln } ifelse 0 sendln - (
) sendln + httpd.textmode { } { msg1 sendln } ifelse result sendln - () sendln + httpd.textmode { } { msg2 sendln } ifelse 0 sendln [(flush)] extension ] pop