Browse Source

[*cgi env]: Fix REQUEST_URI

personal/stbuehler/wip
Stefan Bühler 11 years ago
parent
commit
6164ac83c9
  1. 1
      src/main/url_parser.rl
  2. 17
      tests/t-cgi.py

1
src/main/url_parser.rl

@ -26,6 +26,7 @@
}
action save_query {
g_string_append_len(uri->query, mark, fpc - mark);
g_string_append_len(uri->raw_path, mark-1, fpc - mark+1); /* include '?' in append */
}
action save_scheme {
g_string_append_len(uri->scheme, mark, fpc - mark);

17
tests/t-cgi.py

@ -9,22 +9,31 @@ class CGI(FastCGI):
binary = [ Env.fcgi_cgi ]
SCRIPT_PATHINFO="""#!/bin/sh
SCRIPT_ENVCHECK="""#!/bin/sh
printf 'Status: 200\\r\\nContent-Type: text/plain\\r\\n\\r\\n'
printf '%s' "${PATH_INFO}"
envvar=${QUERY_STRING}
eval val='$'${envvar}
printf '%s' "${val}"
"""
class TestPathInfo1(CurlRequest):
URL = "/pathinfo.cgi/abc/xyz"
URL = "/envcheck.cgi/abc/xyz?PATH_INFO"
EXPECT_RESPONSE_BODY = "/abc/xyz"
EXPECT_RESPONSE_CODE = 200
class TestRequestUri1(CurlRequest):
URL = "/envcheck.cgi/abc/xyz?REQUEST_URI"
EXPECT_RESPONSE_BODY = "/envcheck.cgi/abc/xyz?REQUEST_URI"
EXPECT_RESPONSE_CODE = 200
class Test(GroupTest):
group = [
TestPathInfo1,
TestRequestUri1,
]
config = """
@ -53,4 +62,4 @@ cgi {{
return True
def Prepare(self):
self.PrepareVHostFile("pathinfo.cgi", SCRIPT_PATHINFO, mode = 0755)
self.PrepareVHostFile("envcheck.cgi", SCRIPT_ENVCHECK, mode = 0755)

Loading…
Cancel
Save