ANN: gevent-fastcgi-0.1.16.1dev

47 views
Skip to first unread message

Alex K

unread,
Mar 28, 2013, 6:53:46 PM3/28/13
to gevent: coroutine-based Python network library
I'm pleased to announce new version of gevent-fastcgi FastCGI/WSGI
library/server implemented using gevent.

Changes:
- New IRequestHandler interface (WSGIServer is gone in favour of
gevent_fastcgi.wsgi.WSGIServer)
- New WSGIRequestHandler and WSGIServer classes
- Lots of testing has been changed

Please report any bugs/request any features via https://github.com/momyc/gevent-fastcgi

Sincerely,
Alexander Kulakov

vitaly

unread,
Mar 31, 2013, 1:26:10 AM3/31/13
to gev...@googlegroups.com
Hi Alex,

what's the difference between FastCGI/WSGI and the WSGI implementation that's built into gevent?

Thank you,
Vitaly

Alex K

unread,
Mar 31, 2013, 8:24:14 AM3/31/13
to gevent: coroutine-based Python network library
The main difference is in how they "talk" to outside world. Built-in
gevent.wsgi.WSGIServer (and gevent.pywsgi.WSGIServer) uses HTTP-
protocol while gevent_fastcgi.server.FastCGIServer "talks" FastCGI
protocol, which was specifically designed for communication between
front-end and back-end servers unlike HTTP.

Also, gevent_fastcgi server allows to use non-WSGI request handlers,
i.e. it can be used without WSGI-stack. Following is example of simple
request handler:

def handler(request):
remote_user = request.environ.get('REMOTE_USER', 'stranger')
request.stdout.write('\r\n'.join((
'200 OK',
'Content-type: text/plain',
'',
'Hello, %s!' % (remote_user,),
)))

if __name__ == '__main__':
from gevent_fastcgi.server import FastCGIServer

FastCGIServer('/path/to/unix/socket', handler).serve_forever()


You can also take a look on proof-of-concept CGI-handler at
http://pastebin.com/8c14sSXR than could be used to serve legacy CGI-
scripts via FatsCGI protocol.

- Alex K

vitaly

unread,
Mar 31, 2013, 12:21:00 PM3/31/13
to gev...@googlegroups.com
On Sunday, March 31, 2013 5:24:14 AM UTC-7, Alex K wrote:
The main difference is in how they "talk" to outside world ...

Thank you for the clarification. So, it's probably more appropriate to compare/contrast FastCGI with UWSGI (e.g., the relationship between an NGNX front-end server and an instance of a uWSGI back-end server), right?

Thank you,
Vitaly

Alex K

unread,
Mar 31, 2013, 12:40:50 PM3/31/13
to gevent: coroutine-based Python network library
Well, HTTP protocol has been used for communication between front-end
and back-end servers too so it's comparable to FastCGI, uwsgi, SCGI,
AJP and other protocols used for similar purposes.

Alex K

unread,
Mar 31, 2013, 3:01:23 PM3/31/13
to gevent: coroutine-based Python network library


Alex K wrote:
> The main difference is in how they "talk" to outside world. Built-in
> gevent.wsgi.WSGIServer (and gevent.pywsgi.WSGIServer) uses HTTP-
> protocol while gevent_fastcgi.server.FastCGIServer "talks" FastCGI
> protocol, which was specifically designed for communication between
> front-end and back-end servers unlike HTTP.
>
> Also, gevent_fastcgi server allows to use non-WSGI request handlers,
> i.e. it can be used without WSGI-stack. Following is example of simple
> request handler:
>
> def handler(request):
> remote_user = request.environ.get('REMOTE_USER', 'stranger')
> request.stdout.write('\r\n'.join((
> '200 OK',

In "simple request handle" string literal '200 OK' must be replaced
with 'Status: 200 OK'
Reply all
Reply to author
Forward
0 new messages