| 1 | from base import * |
|---|
| 2 | |
|---|
| 3 | ERROR = 403 |
|---|
| 4 | ERROR_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 |
|---|
| 18 | the lands beyond the edges of the sky, |
|---|
| 19 | so many moons reflected in your eye, |
|---|
| 20 | (familiar newness, fear of leaving port), |
|---|
| 21 | since first you sought, and failed, and learned to fall, |
|---|
| 22 | (first hope, then cynicism, silent dread, |
|---|
| 23 | the countless stars, still counting overhead |
|---|
| 24 | the 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; |
|---|
| 29 | and ashes on the swell are seen no more. |
|---|
| 30 | The silence surges. |
|---|
| 31 | |
|---|
| 32 | <p><b>Error 403</b>. |
|---|
| 33 | </body> |
|---|
| 34 | </html>""" |
|---|
| 35 | |
|---|
| 36 | CONF = """ |
|---|
| 37 | vserver!1!rule!1120!match = directory |
|---|
| 38 | vserver!1!rule!1120!match!directory = /cgi_error_403_1 |
|---|
| 39 | vserver!1!rule!1120!handler = cgi |
|---|
| 40 | vserver!1!rule!1120!handler!error_handler = 1 |
|---|
| 41 | """ |
|---|
| 42 | |
|---|
| 43 | CGI_BASE = """#!/bin/sh |
|---|
| 44 | echo "Content-type: text/html" |
|---|
| 45 | echo "Status: %s" |
|---|
| 46 | echo "" |
|---|
| 47 | cat << EOF |
|---|
| 48 | %s |
|---|
| 49 | EOF |
|---|
| 50 | """ |
|---|
| 51 | |
|---|
| 52 | class 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)) |
|---|