Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 54 lines (42 sloc) 1.47 kb
b7bc8e3 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2505 5dc97367-97f1...
alobbs authored
1 from base import *
2
3 HOST = "192_test"
4 DIR = "192_dir"
5 FILE = "test_file"
6 MAGIC = "something"
7
8 CONF = """
9 vserver!192!nick = %s
10 vserver!192!document_root = %s
11
12 vserver!192!rule!300!match = request
13 vserver!192!rule!300!match!final = 0
14 vserver!192!rule!300!match!request = /%s/(.*)$
15 vserver!192!rule!300!handler = redir
16 vserver!192!rule!300!handler!rewrite!1!show = 0
17 vserver!192!rule!300!handler!rewrite!1!substring = /cgi-bin/program.cgi?param=$1
18
19 vserver!192!rule!200!match = directory
20 vserver!192!rule!200!match!directory = /cgi-bin
21 vserver!192!rule!200!match!final = 1
22 vserver!192!rule!200!handler = cgi
23 vserver!192!rule!200!document_root = %s
24
25 vserver!192!rule!100!match = default
26 vserver!192!rule!100!match!final = 1
27 vserver!192!rule!100!handler = file
28 """
29
30 CGI_BASE = """#!/bin/sh
31 echo "Content-type: text/html"
32 echo
33 echo "%s"
34 """ % (MAGIC)
35
36 class Test (TestBase):
37 def __init__ (self):
38 TestBase.__init__ (self, __file__)
39 self.name = "Hiden Redir: DocumentRoot change"
40 self.request = "GET /%s/%s HTTP/1.0\r\n" % (DIR, FILE) + \
41 "Host: %s\r\n" % (HOST)
42 self.expected_error = 200
43 self.expected_content = MAGIC
44 self.forbidden_content = "/bin/sh"
45
46 def Prepare (self, www):
47 d = self.Mkdir (www, HOST)
48 c = self.Mkdir (d, "cgi-bin_root")
49 self.WriteFile (c, "program.cgi", 0555, CGI_BASE)
50
51 self.conf = CONF % (HOST, d, DIR, c)
52
53
Something went wrong with that request. Please try again.