
cherokee at cherokee-project
Aug 30, 2011, 3:58 AM
Post #1 of 1
(103 views)
Permalink
|
|
[6828] cherokee/trunk/qa/115-Respin.py: Translate a CGI from PHP to Python because php-fpm cannot be used as a
|
|
Revision: 6828 http://svn.cherokee-project.com/changeset/6828 Author: alo Date: 2011-08-30 12:58:48 +0200 (Tue, 30 Aug 2011) Log Message: ----------- Translate a CGI from PHP to Python because php-fpm cannot be used as a regular command line tool to execute PHP (as php-cgi could be). Modified Paths: -------------- cherokee/trunk/qa/115-Respin.py Modified: cherokee/trunk/qa/115-Respin.py =================================================================== --- cherokee/trunk/qa/115-Respin.py 2011-08-30 10:58:44 UTC (rev 6827) +++ cherokee/trunk/qa/115-Respin.py 2011-08-30 10:58:48 UTC (rev 6828) @@ -11,9 +11,6 @@ vserver!1!rule!1151!match = directory vserver!1!rule!1151!match!directory = /respin1-cgi vserver!1!rule!1151!handler = cgi -# CGIs based on PHP need this if php was compiled -# with the 'force-cgi-redirect' enabled. -vserver!1!rule!1151!handler!env!REDIRECT_STATUS = 200 vserver!1!rule!1152!match = request vserver!1!rule!1152!match!request = /respin1/.+/ @@ -24,8 +21,11 @@ """ CGI_BASE = """#!%s -<?php echo "param is ". $_GET["param"]; ?> -""" % (look_for_php()) +import os,cgi +print "Content-type: text/html" +print +print "param is " + cgi.parse_qs(os.getenv('QUERY_STRING'))['param'][0] +""" % (look_for_python()) class Test (TestBase): def __init__ (self): @@ -39,6 +39,3 @@ def Prepare (self, www): d = self.Mkdir (www, "%s-cgi"%(DIR)) self.WriteFile (d, "file", 0755, CGI_BASE) - - def Precondition (self): - return os.path.exists (look_for_php())
|