-
Notifications
You must be signed in to change notification settings - Fork 0
/
ScriptRunner.scgi.in
executable file
·58 lines (42 loc) · 1.31 KB
/
ScriptRunner.scgi.in
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
#!@PIKE@ -M@prefix@/scriptrunner/lib -P@prefix@/scriptrunner/lib
import Tools.Logging;
inherit ScriptRunner.Runner;
constant my_version = "0.4";
//#define RUN_THREADED
string session_storagetype = "ram";
string session_storagedir = ""; // not required for ram storage.
//string session_storagetype = "sqlite";
//string session_storagedir = "/tmp/scriptrunner_storage.db";
//string session_storagetype = "file";
//string session_storagedir = "/tmp/scriptrunner_storage";
string logfile_path = "/tmp/scriptrunner.log";
string session_cookie_name = "PSESSIONID";
int session_timeout = 3600;
string mode = "SCGI";
int my_port = 9999;
Stdio.Port port;
int start_listener(int port)
{
Log.info("Starting listener on port %d.", (int)port);
this->port = Stdio.Port(port, answer_call);
return -1;
}
void answer_call(int sock, int id)
{
Stdio.File fd = port->accept();
requests ++;
object request_id;
mixed e;
if(e=catch(request_id = ScriptRunner.SCGIRequest(fd)))
{
fd->write("Status: 500 Server Error\r\n");
fd->write("Content-type: text/html\r\n\r\n");
fd->write("<h1>Error 500: Internal Server Error</h1>");
fd->write("The server was unable to parse your request.\n");
fd->write("<p>" + describe_backtrace(e));
fd->close();
throw(e);
return;
}
handle_request(request_id, id);
}