File: 103-ScriptName.py

package info (click to toggle)
cherokee 0.7.2-4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,808 kB
  • ctags: 6,577
  • sloc: ansic: 45,071; python: 9,628; sh: 9,468; makefile: 1,639; xml: 61; perl: 32
file content (33 lines) | stat: -rw-r--r-- 1,037 bytes parent folder | download
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
from base import *

PATHINFO    = "this_is_the/path_info"
VIRTUAL_DIR = "/scriptname_vir"
SCRIPT_NAME = VIRTUAL_DIR + "/exec.cgi"

CONF = """
vserver!default!rule!1030!match = directory
vserver!default!rule!1030!match!directory = %s
vserver!default!rule!1030!handler = cgi
vserver!default!rule!1030!document_root = %s
"""

class Test (TestBase):
    def __init__ (self):
        TestBase.__init__ (self)
        self.name = "CGI: ScriptName with PathInfo"

        self.request          = "GET %s/exec.cgi/%s HTTP/1.0\r\n" % (VIRTUAL_DIR, PATHINFO)
        self.expected_error   = 200
        self.expected_content = "SCRIPT_NAME = %s" % (SCRIPT_NAME)

    def Prepare (self, www):
        d = self.Mkdir (www, "script_name_1/sub/dir")
        self.WriteFile (d, "exec.cgi", 0755,
                        """#!/bin/sh

                        echo "Content-Type: text/plain"
                        echo
                        echo "SCRIPT_NAME = $SCRIPT_NAME"
                        """) 

        self.conf = CONF % (VIRTUAL_DIR, d)