INGInious icon indicating copy to clipboard operation
INGInious copied to clipboard

FastCGI detection breaks Gunicorn and other WSGI servers

Open GuillaumeDerval opened this issue 6 years ago • 2 comments

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.

GuillaumeDerval avatar Apr 10 '18 09:04 GuillaumeDerval

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

anthonygego avatar Apr 10 '18 09:04 anthonygego

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.

GuillaumeDerval avatar Apr 10 '18 09:04 GuillaumeDerval