version 1.1, 2014/08/30 11:29:12 |
version 1.3, 2014/08/31 07:53:57 |
|
|
%% $OpenXM$ |
%% $OpenXM: OpenXM/src/kan96xx/Doc/httpd-asir2.sm1,v 1.2 2014/08/30 22:47:20 takayama Exp $ |
%% Asir server to be called from a cgi program. |
%% Asir server to be called from a cgi program. |
|
|
[(parse) (httpd-asir.sm1) pushfile] extension pop |
[(parse) (httpd-asir.sm1) pushfile] extension pop |
|
|
|
%% Default value of timer. Todo, not implemented. |
|
%% /webasir.tlimit (120) def |
|
|
|
%% export CGI_ASIR_ALLOW="[(fctr) (quit)]" |
|
%% export WEBASIR_TYPE="fctr" |
|
%% export OX_ASIR_LOAD_FILE="/private/taka/abc.rr" |
|
%% Start sm1 and webasir2, connect by asir-port/cgi/webasir2.c |
%% Top level script |
%% Top level script |
%% GET /?key=1%2B3%3B [two nl] |
%% GET /?key=1%2B3%3B [two nl] |
%% GET /?msg=httpdAsirMeta+quit HTTP/1.1 [two nl] |
%% GET /?msg=httpdAsirMeta+quit HTTP/1.1 [two nl] |
/httpd-asir2.quit 0 def |
/httpd-asir2.quit 0 def |
/webasir2 { |
/webasir2 { |
[/rrr /cmd /mypid /lockname /mytype] pushVariables |
[/rrr /cmd /mypid /lockname /mytype /lofile] pushVariables |
[ |
[ |
%% This procedure to generate port number might fail. |
%% This procedure to generate port number might fail. |
[(oxGenPass)] extension . (integer) dc /rrr set |
[(oxGenPass)] extension . (integer) dc /rrr set |
|
|
/httpd.port 1200 rrr add def |
/httpd.port 1200 rrr add def |
httpd.port message |
httpd.port message |
|
|
[(getenv) (ASIR_TYPE)] extension isString { |
[(getenv) (CGI_ASIR_ALLOW)] extension tag 0 eq { /mytype (all) def } |
/mytype [(getenv) (ASIR_Type)] extension def |
{oxasirSetSecureFlagFromEnv} ifelse |
} { /mytype (all) def } ifelse |
[(getenv) (WEBASIR_TYPE)] extension isString { |
|
/mytype [(getenv) (WEBASIR_Type)] extension def |
|
} { /mytype (none) def } ifelse |
[(getpid)] extension (dollar) dc /mypid set |
[(getpid)] extension (dollar) dc /mypid set |
[(/tmp/webasir-) mytype (-) mypid (.txt)] cat /lockname set |
[(/tmp/webasir-) mytype (-) mypid (.txt)] cat /lockname set |
[(PrintDollar) 0] system_variable |
[(PrintDollar) 0] system_variable |
|
|
httpd-asir2.quit { exit } { } ifelse |
httpd-asir2.quit { exit } { } ifelse |
} loop |
} loop |
} def |
} def |
|
|
|
% overrides or new for cgiasir.sm1 |
|
/oxasirSetSecureMode { |
|
oxasir.ccc [ ] eq { ox_asirConnectMethod } { } ifelse |
|
oxasir.ccc $ctrl("error_in_timer",1);$ oxsubmit |
|
oxasir.ccc $set_secure_mode(1);$ oxsubmit |
|
} def |
|
|
|
/oxasirSetSecureFlag { |
|
/arg1 set |
|
[/fff ] pushVariables |
|
[ |
|
/fff arg1 def |
|
oxasir.ccc [ ] eq { ox_asirConnectMethod } { } ifelse |
|
oxasir.ccc [$set_secure_flag("$ fff toString $",1);$] cat oxsubmit |
|
oxasir.ccc oxpopcmo |
|
] pop |
|
popVariables |
|
} def |
|
|
|
%%% |
|
/oxasirSetSecureFlagFromEnv { |
|
[(getenv) (CGI_ASIR_ALLOW)] extension isString { |
|
[(getenv) (CGI_ASIR_ALLOW)] extension /cgiAsirAllow.s set |
|
[(parse) cgiAsirAllow.s] extension pop /cgiAsirAllow.p set |
|
cgiAsirAllow.p isArray { |
|
cgiAsirAllow.p /cgiAsirAllow set |
|
} { } ifelse |
|
} { } ifelse |
|
cgiAsirAllow {oxasirSetSecureFlag} map |
|
oxasirSetSecureMode |
|
} def |
|
|