UCL-INGI / INGInious

INGInious is a secure and automated exercises assessment platform using your own tests, also providing a pluggable interface with your existing LMS.
http://www.inginious.org
Other
208 stars 140 forks source link

FastCGI detection breaks Gunicorn and other WSGI servers #317

Open GuillaumeDerval opened 6 years ago

GuillaumeDerval commented 6 years ago

These lines in inginious-webapp do not work properly:

if 'SERVER_SOFTWARE' in os.environ:  # cgi
    os.environ['FCGI_FORCE_CGI'] = 'Y'

if 'PHP_FCGI_CHILDREN' in os.environ or 'SERVER_SOFTWARE' in os.environ:  # lighttpd fastcgi
    print(os.environ)
    import flup.server.fcgi as flups
    flups.WSGIServer(application, multiplexed=True, bindAddress=None, debug=False).run()

Gunicorn is a WSGI server but defines SERVER_SOFTWARE, and a such we start the flup FCGI server.

anthonygego commented 6 years ago

As already mentioned, I think the inginious-webapp script should take an additional argument to make the protocol explicit.

GuillaumeDerval commented 6 years ago

Making WSGI the default is the best way; like that, the code can be imported from any python code and work as-is. Adding a cmd arg --cgi would be enough I think.