[mod_python] BUG IN cgihandler / setup_cgi

Andre Reitz reitz at inworks.de
Mon Mar 11 19:19:04 EST 2002


def setup_cgi(req):
    """
    Replace sys.stdin and stdout with an objects that read/write to
    the socket, as well as substitute the os.environ.
    Returns (environ, stdin, stdout) which you must save and then use
    with restore_nocgi().
    """

    # save env
    env = os.environ.copy() <<<< 1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    si = sys.stdin
    so = sys.stdout

    env = build_cgi_env(req) <<<<< 2 !!!!!!!!!!!!!!!!!!!

    for k in env.keys():
        os.environ[k] = env[k]

    sys.stdout = CGIStdout(req)
    sys.stdin = CGIStdin(req)

    sys.argv = [] # keeps cgi.py happy

    return env, si, so <<<< 3 !!!!!!!!!!!!!!!!!!!!!!!!!


- The env (1) perhaps should be called originalenv
- (2) keep as is
- (3) change to: return originalenv, si, so


Will somebody patch it?

This can cause critical bugs!

Greetings, Andre'

--
_____________________________________________
inworks GmbH            Andre Reitz
Magirusstrasse 44       Tel. 0731/93 80 7-21
89077 Ulm               http://www.inworks.de

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.modpython.org/pipermail/mod_python/attachments/20020311/a753796f/attachment-0003.htm


More information about the Mod_python mailing list