summaryrefslogtreecommitdiff
path: root/htc/http.htc
diff options
context:
space:
mode:
Diffstat (limited to 'htc/http.htc')
-rw-r--r--htc/http.htc61
1 files changed, 61 insertions, 0 deletions
diff --git a/htc/http.htc b/htc/http.htc
new file mode 100644
index 0000000..c9a8557
--- /dev/null
+++ b/htc/http.htc
@@ -0,0 +1,61 @@
1\include{system.htc}
2\include{tree.htc}
3\include{layout.htc}
4\include{upload.htc}
5\include{posit.htc}
6\const{server}{http://\HOST\if(\port!=80){:\port}}
7\const{server.alias}(\HOST left ".")
8\const{server.admin}{\ADMIN}
9%
10% Some special stuff
11%
12\def{setcookie}{xx?}{
13 \resp.cookie{\1}{\2}{
14% domain=\HOST\; path=/\if(\0){; expires=\time2http{\0}}
15% the domain spec above does not work on modern browsers such as firefox
16% if host is not a fully qualified dns name
17 path=/\if(\0){; expires=\time2http{\0}}
18 }
19}
20\def{redirect}{x}{
21 \if(\req.version gt "HTTP/1.0"){
22 \resp.status{\HTTP.303}
23 }{
24 \resp.status{\HTTP.302}
25 }
26 \if(\1 cnt ":"){
27 \resp.location{\1}
28 }{
29 \resp.location{\server\1}
30 }
31}
32\def{onget}{r}{
33 \if("GET HEAD" which \req.method){
34 \1
35 }
36}
37\def{onpost}{r}{
38 \if(\req.method eq "POST"){
39 \1
40 }
41}
42%
43% Cookie allowance
44%
45\def{cookie.allow}{x}{
46 [ok:=1;name:=first \1;val:=rest \1];
47 \if(name ne ""){
48 [ok=0];
49 \for(i:=0)(i<\ncookie)(i+=1){
50 \if(\cookie[i].name eq name && \cookie[i].val eq val)(ok=1);
51 }
52 };
53 [ok]
54}
55%
56% CRONTAB
57%
58\cron(211){\sync}
59\cron(120){\tree.update}
60\cron(300){\tempfile.update}
61