/usr/lib/kaya/cgi.ks is in kaya 0.4.4-6.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | // -*-C-*-ish
import IO;
import System;
import CGI;
import WebCommon;
import Crypto;
import System;
default Void PreContent()
{
}
default Void PostContent()
{
}
default Void Handlers()
{
}
default Void webconfig()
{
}
Void __panic(String err, Int code)
{
CGI::flushAll();
putStrLn("Kaya panic: "+err+" ("+code+")");
}
Void __start() {
Prelude::gcIncremental();
try {
module::webconfig();
module::Handlers();
// modify the query string according to the registered handlers
qstring = expandQuery(getEnv("QUERY_STRING"));
WebCommon::initWebApp(qstring,System::getEnv,IO::getChar@(stdin),IO::eof@(stdin));
if (WebCommon::incomingExists("kaya_function",DataRequest)) {
dfun=WebCommon::incomingValue("kaya_function",DataRequest);
} else {
dfun="";
}
if (WebCommon::incomingExists("kaya_prepost",DataRequest)) {
dprepost=WebCommon::incomingValue("kaya_prepost",DataRequest);
} else {
dprepost="";
}
prepost=true;
if (dprepost!="") {
Int x = Builtins::unmarshal(Crypto::decode(dprepost),0);
if (x==0) prepost = false;
}
if (prepost) {
module::PreContent();
}
if (dfun!="") {
fnstr = Crypto::decode(dfun);
Void(arg) fn = Builtins::unmarshal(fnstr,888);
id = Builtins::fnid(fn);
if (WebCommon::incomingExists("kaya_arg",DataRequest)) {
darg=WebCommon::incomingValue("kaya_arg",DataRequest);
} else {
darg="";
}
dat = Builtins::unmarshal(Crypto::decode(darg),id);
fn(dat);
} else {
module::Default();
}
if (prepost) {
module::PostContent();
}
CGI::flushAll();
}
catch(err) {
// content(exceptionMessage(err)+" (code "+exceptionCode(err)+")");
CGI::flushAll();
exceptionBacktrace(err);
}
WebCommon::removeTemporaryUploaded();
}
|