summaryrefslogtreecommitdiff
path: root/rc/bin/rc-httpd/handlers/error
blob: e0608a9888835c4797d3247e1ac6258b6b22ef39 (plain)
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
#!/bin/rc
# DO NOT make this script callable directly from the web!
fn do_error{
	echo 'HTTP/1.1 '^$1^$cr
	emit_extra_headers
	echo 'Content-type: text/html; charset=utf-8'^$cr
	echo $cr
	echo '<html>
<head>
<title>'^$1^'</title>
</head>
<body>
<h1>'^$1^'</h1>'
	echo $2
	echo '<p><i>rc-httpd at' $SERVER_NAME '</i>'
	echo '
	</body>
	</html>
	'
}

fn 401{
	do_error '401 Unauthorized' \
	'The requested path '^$"location^' requires authorization.'
}

fn 404{
	do_error '404 Not Found' \
	'The requested path '^$"location^' was not found on this server.'
}

fn 500{
	do_error '500 Internal Server Error' \
	'The server has encountered an internal misconfiguration and is unable to satisfy your request.'
}

fn 503{
	do_error '503 Forbidden' \
	'You do not have permission to access '^$"location^' on this server.'
}

do_log $1
$1