Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 67 lines (51 sloc) 1.932 kb
298031a @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@799 5dc97367-97f1-...
alobbs authored
1 import os
2 from base import *
5712b17 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2745 5dc97367-97f1...
alobbs authored
3 from util import *
298031a @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@799 5dc97367-97f1-...
alobbs authored
4
c0832cf @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@1949 5dc97367-97f1...
alobbs authored
5 DIR = "/SCGI4/"
6 PORT = get_free_port()
7 PYTHON = look_for_python()
298031a @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@799 5dc97367-97f1-...
alobbs authored
8
9 HDR1 = "X-Whatever"
10 VAL1 = "Value1"
11
12 HDR2 = "Something"
13 VAL2 = "Second"
14
15 SCRIPT = """
16 from pyscgi import *
17
18 class TestHandler (SCGIHandler):
19 def handle_request (self):
20 self.handle_post()
6998e85 @alobbs - Updates pyscgi.py from 1.7 to 1.9
alobbs authored
21 self.send('Content-Type: text/plain\\r\\n\\r\\n')
298031a @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@799 5dc97367-97f1-...
alobbs authored
22
23 for v in self.env:
6998e85 @alobbs - Updates pyscgi.py from 1.7 to 1.9
alobbs authored
24 self.send('%%s: %%s\\n' %% (v, self.env[v]))
298031a @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@799 5dc97367-97f1-...
alobbs authored
25
26 SCGIServer(TestHandler, port=%d).serve_forever()
27 """ % (PORT)
28
c0832cf @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@1949 5dc97367-97f1...
alobbs authored
29 source = get_next_source()
30
298031a @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@799 5dc97367-97f1-...
alobbs authored
31 CONF = """
8e7efc4 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@1738 5dc97367-97f1...
alobbs authored
32 vserver!1!rule!1420!match = directory
c0832cf @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@1949 5dc97367-97f1...
alobbs authored
33 vserver!1!rule!1420!match!directory = %(DIR)s
8e7efc4 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@1738 5dc97367-97f1...
alobbs authored
34 vserver!1!rule!1420!handler = scgi
35 vserver!1!rule!1420!handler!pass_req_headers = 1
36 vserver!1!rule!1420!handler!balancer = round_robin
c0832cf @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@1949 5dc97367-97f1...
alobbs authored
37 vserver!1!rule!1420!handler!balancer!source!1 = %(source)d
38
39 source!%(source)d!type = interpreter
40 source!%(source)d!host = localhost:%(PORT)d
41 source!%(source)d!interpreter = %(PYTHON)s %(scgi_file)s
298031a @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@799 5dc97367-97f1-...
alobbs authored
42 """
43
44 class Test (TestBase):
45 def __init__ (self):
bc8d926 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2179 5dc97367-97f1...
alobbs authored
46 TestBase.__init__ (self, __file__)
298031a @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@799 5dc97367-97f1-...
alobbs authored
47 self.name = "SCGI IV: Extra variables"
48
49 self.request = "GET %s HTTP/1.0\r\n" %(DIR) + \
50 "%s: %s\r\n" % (HDR1, VAL1) + \
51 "%s: %s\r\n" % (HDR2, VAL2)
52 self.expected_error = 200
5712b17 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2745 5dc97367-97f1...
alobbs authored
53 self.expected_content = ['%s: %s'%(get_forwarded_http_header(HDR1), VAL1),
54 '%s: %s'%(get_forwarded_http_header(HDR2), VAL2)]
298031a @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@799 5dc97367-97f1-...
alobbs authored
55 self.forbidden_content = ['pyscgi', 'SCGIServer', 'write']
56
57 def Prepare (self, www):
58 scgi_file = self.WriteFile (www, "scgi_test4.scgi", 0444, SCRIPT)
59
60 pyscgi = os.path.join (www, 'pyscgi.py')
61 if not os.path.exists (pyscgi):
62 self.CopyFile ('pyscgi.py', pyscgi)
63
c0832cf @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@1949 5dc97367-97f1...
alobbs authored
64 vars = globals()
65 vars['scgi_file'] = scgi_file
66 self.conf = CONF % (vars)
Something went wrong with that request. Please try again.