-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.d
More file actions
38 lines (32 loc) · 930 Bytes
/
main.d
File metadata and controls
38 lines (32 loc) · 930 Bytes
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
/*
Rhodeus Script (c) by Talha Zekeriya Durmuş
Rhodeus Script is licensed under a
Creative Commons Attribution-NoDerivs 3.0 Unported License.
You should have received a copy of the license along with this
work. If not, see <http://creativecommons.org/licenses/by-nd/3.0/>.
*/
module main;
import library.cgi,std.file : getcwd;
import Script;
import errorHandling.errorHandler;
import std.process: getenv, environment;
void handler(Cgi cgi){
Script script;
try{
script = new Script();
}catch(RhError re){
cgi.setResponseStatus("503 Service Unavailable");
cgi.write("Bad configuration file!");
return;
}
string response;
try{
response = script.execute(getenv("PATH_TRANSLATED"), cgi);
}catch(RhError x){
response ~= "Hata: "~x.msg ~"<br>\nSatır: "~text(x.line);
}catch(Throwable x){
response ~= "Hata: "~x.msg;
}
cgi.write(response);
}
mixin GenericMain!handler;