root/cherokee/trunk/qa/112-NiceError-CGI.py

Revision 2476, 1.8 KB (checked in by alo, 22 months ago)
Line 
1from base import *
2
3ERROR     = 403
4ERROR_MSG = """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5
6<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
7<head>
8 <title>Permission Denied - Cherokee Web Server</title>
9</head>
10
11 <body>
12
13 <!-- Poem by Thomas Thurman <thomas@thurman.org.uk> -->
14
15 <h1>403 Access Denied</h1>
16
17<p>So many years have passed since first you sought
18the lands beyond the edges of the sky,
19so many moons reflected in your eye,
20(familiar newness, fear of leaving port),
21since first you sought, and failed, and learned to fall,
22(first hope, then cynicism, silent dread,
23the countless stars, still counting overhead
24the seconds to your final voyage of all...)
25   and last, in glory gold and red around
26   your greatest search, your final quest to know!
27   yet... ashes drift, the embers cease to glow,
28   and darkened life in frozen death is drowned;
29and ashes on the swell are seen no more.
30The silence surges.
31
32<p><b>Error 403</b>.
33 </body>
34</html>"""
35
36CONF = """
37vserver!1!rule!1120!match = directory
38vserver!1!rule!1120!match!directory = /cgi_error_403_1
39vserver!1!rule!1120!handler = cgi
40vserver!1!rule!1120!handler!error_handler = 1
41"""
42
43CGI_BASE = """#!/bin/sh
44echo "Content-type: text/html"
45echo "Status: %s"
46echo ""
47cat << EOF
48%s
49EOF
50"""
51
52class Test (TestBase):
53    def __init__ (self):
54        TestBase.__init__ (self, __file__)
55        self.name = "CGI error message"
56
57        self.request           = "GET /cgi_error_403_1/exec.cgi HTTP/1.0\r\n"
58        self.expected_error    = ERROR
59        self.expected_content  = ERROR_MSG
60        self.conf              = CONF
61
62    def Prepare (self, www):
63        d = self.Mkdir (www, "cgi_error_403_1")
64        f = self.WriteFile (d, "exec.cgi", 0555, CGI_BASE % (ERROR, ERROR_MSG))
Note: See TracBrowser for help on using the browser.