Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 37 lines (29 sloc) 1.146 kb
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
from base import *

COMMENT = "This is comment inside the CGI"
TEXT = "It should be printed by the CGI"

CONF = """
vserver!1!rule!1100!match = directory
vserver!1!rule!1100!match!directory = /request_entry1
vserver!1!rule!1100!handler = file

vserver!1!rule!1101!match = request
vserver!1!rule!1101!match!request = request_entry1.*cgi$
vserver!1!rule!1101!handler = cgi
"""

class Test (TestBase):
    def __init__ (self):
        TestBase.__init__ (self, __file__)
        self.name = "Priorities: Dir and then Req"

        self.request = "GET /request_entry1/sub/exec.cgi HTTP/1.0\r\n"
        self.expected_error = 200
        self.expected_content = TEXT
        self.forbidden_content = COMMENT
        self.conf = CONF

    def Prepare (self, www):
        d = self.Mkdir (www, "request_entry1/sub")
        f = self.WriteFile (d, "exec.cgi", 0555,
                            """#!/bin/sh

echo "Content-type: text/html"
echo ""
# %s
echo "%s"
""" % (COMMENT, TEXT))
Something went wrong with that request. Please try again.