[mod_python] CGI Environment Specs

Yandle, Hans Hans.Yandle at cingular.com
Tue May 21 10:42:11 EST 2002


I am looking into the possibility of using mod_python to accelerate and/or
replace some of my cgi scripts. However, I lack one last detail before I can
attempt this task. One of my cgi scripts uses the HTTP_REFERER environment
variable. After reading the docs, I made the following script using the
mod_python.publisher handler:

from mod_python import apache

def commonenv(req):
    req.content_type = "text/html"
    req.send_http_header()
    req.add_common_vars()
    s = """<html><head><title>Mod_Python Common Environment
Variables</title></head>
           <body><p
align=center><table><tr><td>Parameter</td><td>Value</td></tr>"""
    for parameter in req.subprocess_env.keys():
        s = s + "<tr><td>%s</td><td>%s</td></tr>" % (parameter,
req.subprocess_env[parameter])
    s = s + "</table></p></body></html>"
    return s

When it is executed, the HTTP_REFERER variable is missing. If anyone knows
how to accomplish this, I would be grateful.

Hans




More information about the Mod_python mailing list