Skip to content

Commit

Permalink
git-svn-id: svn://cherokee-project.com/cherokee/trunk@599 5dc97367-97…
Browse files Browse the repository at this point in the history
…f1-0310-9951-d761b3857238
  • Loading branch information
alobbs committed Jan 11, 2007
1 parent 46f5bde commit 61fcba4
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 1 deletion.
7 changes: 7 additions & 0 deletions ChangeLog
@@ -1,5 +1,12 @@
2007-01-11 Alvaro Lopez Ortega <alvaro@alobbs.com>

* qa/141-FastCGI-EmptyVars.py: Added new QA test to ensure that
PATH_INFO and QUERY_STRING are sent to the FastCGI servers even if
there are empty strings.

* cherokee/handler_cgi_base.c (cherokee_handler_cgi_base_build_basic_env):
Added SERVER_NAME variable. WSGI was complaining because of this.

* qa/fcgi.py: Added new python module.

* qa/Makefile.am (EXTRA_DIST): Added pyscgi.py and fcgi.py
Expand Down
1 change: 1 addition & 0 deletions cherokee/handler_cgi_base.c
Expand Up @@ -256,6 +256,7 @@ cherokee_handler_cgi_base_build_basic_env (cherokee_handler_cgi_base_t
/* Set the basic variables
*/
set_env (cgi, "SERVER_SOFTWARE", "Cherokee " PACKAGE_VERSION, 9 + (sizeof(PACKAGE_VERSION) - 1));
set_env (cgi, "SERVER_NAME", "Cherokee", 8);
set_env (cgi, "SERVER_SIGNATURE", "<address>Cherokee web server</address>", 38);
set_env (cgi, "GATEWAY_INTERFACE", "CGI/1.1", 7);
set_env (cgi, "PATH", "/bin:/usr/bin:/sbin:/usr/sbin", 29);
Expand Down
2 changes: 1 addition & 1 deletion qa/140-SCGI-EmptyVars.py
Expand Up @@ -25,7 +25,7 @@ def handle_request (self):
vserver!default!directory!<dir>!handler!balancer!type = interpreter
vserver!default!directory!<dir>!handler!balancer!local_scgi2!host = localhost:%d
vserver!default!directory!<dir>!handler!balancer!local_scgi2!interpreter = %s %s
vserver!default!directory!<dir>!priority = 1270
vserver!default!directory!<dir>!priority = 1400
"""


Expand Down
50 changes: 50 additions & 0 deletions qa/141-FastCGI-EmptyVars.py
@@ -0,0 +1,50 @@
import os
from base import *

DIR = "/FCGI-EmptyVars/"
MAGIC = "Cherokee and FastCGI rocks!"
PORT = 5004

SCRIPT = """
from fcgi import *
def app (environ, start_response):
start_response('200 OK', [("Content-Type", "text/plain")])
resp = ""
for k in environ:
resp += '%%s: %%s\\n' %% (k, environ[k])
return [resp]
WSGIServer(app, bindAddress=("localhost",%d)).run()
""" % (PORT)

CONF = """
vserver!default!directory!<dir>!handler = fcgi
vserver!default!directory!<dir>!handler!balancer = round_robin
vserver!default!directory!<dir>!handler!balancer!type = interpreter
vserver!default!directory!<dir>!handler!balancer!1!host = localhost:%d
vserver!default!directory!<dir>!handler!balancer!1!interpreter = %s %s
vserver!default!directory!<dir>!priority = 1410
"""


class Test (TestBase):
def __init__ (self):
TestBase.__init__ (self)
self.name = "FastCGI: Variables"

self.request = "GET %s HTTP/1.0\r\n" %(DIR)
self.expected_error = 200
self.expected_content = ['PATH_INFO:', 'QUERY_STRING:']
self.forbidden_content = ['from fcgi', 'start_response']

def Prepare (self, www):
fcgi_file = self.WriteFile (www, "fcgi_test_vbles.fcgi", 0444, SCRIPT)

fcgi = os.path.join (www, 'fcgi.py')
if not os.path.exists (fcgi):
self.CopyFile ('fcgi.py', fcgi)

self.conf = CONF % (PORT, look_for_python(), fcgi_file)
self.conf = self.conf.replace ('<dir>', DIR)

0 comments on commit 61fcba4

Please sign in to comment.