Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 62 lines (47 sloc) 1.928 kb
bb276e2 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@1960 5dc97367-9…
alobbs authored
1 from base import *
2
3 DIR = "chunked_scgi_1"
4 MAGIC = letters_random (300)
5
6 CHUNKED_BEGIN = hex(len(MAGIC))[2:] + '\r\n'
7 CHUNKED_FINISH = "0\r\n\r\n"
8
9 PORT = get_free_port()
10 PYTHON = look_for_python()
11 source = get_next_source()
12
13 SCRIPT = """
14 from pyscgi import *
15
16 class TestHandler (SCGIHandler):
17 def handle_request (self):
18 self.handle_post()
6998e85 @alobbs - Updates pyscgi.py from 1.7 to 1.9
alobbs authored
19 # self.send('Content-Length: %d\\r\\n')
20 self.send('Content-Type: text/plain\\r\\n\\r\\n')
21 self.send('%s')
bb276e2 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@1960 5dc97367-9…
alobbs authored
22
23 SCGIServer(TestHandler, port=%d).serve_forever()
24 """ % (len(MAGIC), MAGIC, PORT)
25
26 CONF = """
27 vserver!1!rule!1730!match = directory
28 vserver!1!rule!1730!match!directory = /%(DIR)s
29 vserver!1!rule!1730!handler = scgi
30 vserver!1!rule!1730!handler!balancer = round_robin
31 vserver!1!rule!1730!handler!balancer!source!1 = %(source)d
32
33 source!%(source)d!type = interpreter
34 source!%(source)d!host = localhost:%(PORT)d
35 source!%(source)d!interpreter = %(PYTHON)s %(scgi_file)s
36 """
37
38 class Test (TestBase):
39 def __init__ (self):
bc8d926 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@2179 5dc97367-9…
alobbs authored
40 TestBase.__init__ (self, __file__)
bb276e2 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@1960 5dc97367-9…
alobbs authored
41 self.name = "Chunked encoding: scgi"
42
43 self.request = "GET /%s/test HTTP/1.1\r\n" % (DIR) + \
0684479 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@1962 5dc97367-9…
alobbs authored
44 "Host: localhost\r\n" + \
7d156e9 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@1963 5dc97367-9…
alobbs authored
45 "Connection: Keep-Alive\r\n\r\n" + \
46 "OPTIONS / HTTP/1.0\r\n"
0684479 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@1962 5dc97367-9…
alobbs authored
47
bb276e2 @alobbs git-svn-id: svn://cherokee-project.com/cherokee/trunk@1960 5dc97367-9…
alobbs authored
48 self.expected_error = 200
49 self.expected_content = ["Transfer-Encoding: chunked",
50 CHUNKED_BEGIN, MAGIC, CHUNKED_FINISH]
51
52 def Prepare (self, www):
53 scgi_file = self.WriteFile (www, "scgi_chunked1.scgi", 0444, SCRIPT)
54
55 pyscgi = os.path.join (www, 'pyscgi.py')
56 if not os.path.exists (pyscgi):
57 self.CopyFile ('pyscgi.py', pyscgi)
58
59 vars = globals()
60 vars['scgi_file'] = scgi_file
61 self.conf = CONF % (vars)
Something went wrong with that request. Please try again.