=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Doc/httpd.sm1,v retrieving revision 1.6 retrieving revision 1.19 diff -u -p -r1.6 -r1.19 --- OpenXM/src/kan96xx/Doc/httpd.sm1 2002/10/17 13:40:28 1.6 +++ OpenXM/src/kan96xx/Doc/httpd.sm1 2005/11/21 12:46:49 1.19 @@ -1,11 +1,31 @@ -%% $OpenXM: OpenXM/src/kan96xx/Doc/httpd.sm1,v 1.5 2001/09/20 05:57:40 takayama Exp $ +%% $OpenXM: OpenXM/src/kan96xx/Doc/httpd.sm1,v 1.18 2005/11/21 09:12:22 takayama Exp $ %% common modules for httpd on sm1. +% [(Strict) 1] system_variable % for debugging. /Oxserver_history_variable (Oxserver_history_variable_) def /httpd.image.type [(getenv) (OpenXM_PSTOIMG_TYPE)] extension def +/httpd_sm1.cookie + [(oxGenPass)] extension +def +/httpd.set-cookie { + [(Set-Cookie: httpd_sm1=) httpd_sm1.cookie] cat +} def + +[(getenv) (OXWEB_DEBUG)] extension tag 0 eq { + /httpd.debug 0 def +} { + /httpd.debug 1 def +} ifelse +[(getenv) (OXWEB_TAKE_LOG)] extension tag 0 eq { + /httpd.take.log 0 def +} { + /httpd.take.log 1 def +} ifelse + + /httpd_startserver { [(sm1.socket) (open) [httpd.port (localhost)]] extension /httpd.server.fdAndPort set @@ -27,7 +47,7 @@ def /sendln { /arg1 set - [/in-sendln /mmm] pushVariables + [/in-sendln /mmm /i] pushVariables [ arg1 /mmm set mmm tag 5 eq { [mmm 10 (string) dc] cat /mmm set @@ -37,7 +57,8 @@ def [(sm1.socket) (select) [httpd.server.fd 0 get 0]] extension { (Warning (sendln): your peer closed the connection. Do not send the data.) message } { - [(sm1.socket) (write) [httpd.server.fd 0 get mmm]] extension message + [(sm1.socket) (write) [httpd.server.fd 0 get mmm]] extension /i set + httpd.debug { i message } { } ifelse } ifelse ] pop popVariables @@ -70,10 +91,12 @@ def /httpd.serial 0 def /httpd.history [ ] def /httpd.result.history [ 0 ] def + [(nobody)] extension pop { httpd_startserver ; httpd_action ; httpd_stopserver ; + httpd.take.log { (date) system } { } ifelse % (sleep 2) system httpd.serial 1 add /httpd.serial set } loop @@ -120,6 +143,7 @@ def (HTTP/0.9 200 OK) sendln (Connection: close) sendln (Content-Type: text/html) sendln + httpd.set-cookie sendln 0 sendln %% (